CSES - Veijocrypt
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Today Veijo tried out the following function f(x)f(x):

unsigned f(unsigned x) {
     unsigned a = 28;
     unsigned b = 6;
     unsigned c = 2017;
     x += a;
     x ^= (x >> b);
     x *= c;
     return x;
}

(Note that here all variables are unsigned integers, so all arithmetic is done modulo 2322^{32}.)

Veijo discovered that f(x)f(x) is actually reversible: for any value yy there is exactly one value xx with y=f(x)y = f(x). There really has to be something magic about the date 2017-06-28, as this didn't seem to work if you use e.g. 2016 instead of 2017!

So Veijo thought you could maybe use f(x)f(x) for encryption; if it is reversible, it is at least in principle possible to do decryption. But f(x)f(x) alone looks a bit weak, so for extra obfuscation Veijo defined g(x,m)g(x,m), which is mm iterations of fuction ff: for example, g(x,0)=xg(x,0) = x, g(x,1)=f(x)g(x,1) = f(x), g(x,2)=f(f(x))g(x,2) = f(f(x)), g(x,3)=f(f(f(x)))g(x,3) = f(f(f(x))), and so on.

Now your task is to write a program that calculates the g(x,m)g(x,m) values.

Input

The first line contains two numbers, nn and mm. Then follows nn lines. Line ii contains just one number, xix_i.

Output

Print nn lines of output. Line ii should contain just one number, g(xi,m)g(x_i, m).

Limits

  • 1n1001 \le n \le 100
  • 1m1071 \le m \le 10^7
  • 0xi23210 \le x_i \le 2^{32}-1

Example

Input:

2 3
3280387012
1095513148

Output:

3347635925
1977414679

Here, for example, f(f(f(3280387012)))=3347635925f(f(f(3280387012))) = 3347635925.