#nt401. 线性筛

线性筛

Linear Sieve

Problem Description

Given a number nn, find all primes pp in the range 1∼n1 \sim n.

To keep the output from being too large and to prevent precomputing answers from a table, you are also given a,ba, b; output the XOR sum of (a⋅p+b) mod 232(a \cdot p + b) \bmod 2^{32} over all such primes.

Input Format

The first line contains three integers n,a,bn, a, b.

Output Format

Output one integer: the answer.

Sample Input

100 1 0

Sample Output

64

Constraints

For all data, 1≤n≤5×1071 \leq n \leq 5 \times 10^7, 0≤a,b<2320 \leq a, b < 2^{32}.