You are given *n* numbers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. You can perform at most *k* operations. For each operation you can multiply one of the numbers by *x*. We want to make <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/1faa5be276f646dfb07d2a01bf67449ad72c0ef7.png" style="max-width: 100.0%;max-height: 100.0%;"/> as large as possible, where <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/ddbf6923ea3f08cb83b08ed026f40a80751dff3f.png" style="max-width: 100.0%;max-height: 100.0%;"/> denotes the bitwise OR. 

Find the maximum possible value of <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/1faa5be276f646dfb07d2a01bf67449ad72c0ef7.png" style="max-width: 100.0%;max-height: 100.0%;"/> after performing at most *k* operations optimally.
The first line contains three integers *n*, *k* and *x* (1 ≤ *n* ≤ 200 000, 1 ≤ *k* ≤ 10, 2 ≤ *x* ≤ 8).

The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
#include <iostream>

using namespace std;
long long num[200004];
long long ans =-1,lans;
int bit[60];
long long get_num(){
    long long rans = 0;
    long long cnt =1;
    for(int i=0;i<60;i++){
        if(bit[i]!=0)rans += cnt;
        cnt *= 2;
    }
    return rans;
}
void addin(long long num){
    int idex = 0;
    while(num!=0){
        bit[idex] += num%2;
        num/=2;
        idex ++;
    }
}
void cutout(long long num){
    int idex = 0;
    while(num!=0){
        bit[idex] -= num%2;
        num/=2;
        idex ++;
    }
}
int main()
{
    long long n , k, x,t=1;

    cin>>n>>k>>x;

    while(k--){
        t*=x;
    }

    for(int i=0;i<n;i++){
        cin>>num[i];
    }

    for(int i=0;i<n;i++){
        addin(num[i]);
    }
    for(int i=0;i<n;i++){
        cutout(num[i]);
        num[i] *= t;
        addin(num[i]);
        lans = get_num();
        ans = ans>lans?ans:lans;
        cutout(num[i]);
        num[i] /= t;
        addin(num[i]);
    }
    cout<<ans<<endl;
    return 0;
}

    				 	 	   	       				 		