#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
//#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
int a[200004];
int pre[200004];
int suff[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
     scanf("%d",&n);scanf("%d",&k);scanf("%d",&x);
    for(int u=1;u<=n;u++){
        scanf("%d",&a[u]);
    }
    ll int uu=pow(x,k);
    for(int u=1;u<=n;u++){
        if(u==0)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(int u=n;u>=1;u--){
        if(u==n-1)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    int ans;
    for(int u=1;u<=n;u++){
        ans=max(ans,pre[u-1]|suff[u+1]|a[u]*int(pow(x,k)));
    }
    printf("%d\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
ll int a[2000004];
ll int pre[2000004];
ll int suff[2000004];
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n-1)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    ll int ans1=INT_MIN;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
//#define gc getchar_unlocked
//#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
vector<ll int>a;
vector<ll int>suff;
vector<ll int>pre;
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
     a=vector<ll int>(n+3,0);
    pre=vector<ll int>(n+3,0);
    suff=vector<ll int>(n+3,0);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    pre[0]=0;
    suff[n+1]=0;
    ll int uu=pow(x,k);
//  for(ll int r=1;r<=k;r++)
//  {
//      uu*=x;
//  }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u+1]|a[u];
    }
    ll int ans1;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
    a.clear();pre.clear();suff.clear();
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
ll int a[200004];
ll int pre[200004];
ll int suff[200004];
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==0)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n-1)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    ll int ans1=INT_MIN;
    for(ll int u=1;u<=n;u++){
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
//#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
int a[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
     scanf("%d",&n);scanf("%d",&k);scanf("%d",&x);
    for(int u=0;u<=n-1;u++){
        scanf("%d",&a[u]);
    }
    sort(a,a+n);
    for(int u=1;u<=k;u++){
        a[n-1]*=x;
    }
    int ans;
    for(int u=0;u<n;u++){
        if(u==0)
        ans=a[u];
        else ans=ans|a[u];
    }
    printf("%d\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
int a[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
     scanf("%d",&n);scanf("%d",&k);scanf("%d",&x);
    for(int u=0;u<=n-1;u++){
        scanf("%d",&a[u]);
    }
    sort(a,a+n);
    int last=a[n-1];
    int first=a[0];
    for(int u=1;u<=k;u++){
        last*=x;
        first*=x;
    }
    int ans;
    int ans1;
    for(int u=0;u<n;u++){
       if(u==0){
        ans=a[u];

       }
       else{
        if(u==n-1)
        ans=ans|last;

       else ans=ans|a[u];}
    }
    for(int r=0;r<n;r++){
        if(r==0){
            ans1=first;
        }
        else ans1=ans1|a[r];
    }
    printf("%d\n",max(ans,ans1));
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
vector<ll int>a;
vector<ll int>suff;
vector<ll int>pre;
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
     a=vector<ll int>(n+3,0);
    pre=vector<ll int>(n+3,0);
    suff=vector<ll int>(n+3,0);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    pre[0]=0;
    suff[n+1]=0;
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    ll int ans1;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
    a.clear();pre.clear();suff.clear();
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
ll int a[2000004];
ll int pre[2000004];
ll int suff[2000004];
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    ll int ans1=INT_MIN;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
vector<ll int>a;
vector<ll int>suff;
vector<ll int>pre;
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
     a=vector<ll int>(n+3,0);
    pre=vector<ll int>(n+3,0);
    suff=vector<ll int>(n+3,0);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    pre[0]=0;
    suff[n+1]=0;
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u+1]|a[u];
    }
    ll int ans1;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
    a.clear();pre.clear();suff.clear();
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
ll int a[200004];
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
    for(ll int u=0;u<=n-1;u++){
        scanf("%lld",&a[u]);
    }
    sort(a,a+n);
    ll int last=a[n-1];
    ll int first=a[0];
    for(ll int u=1;u<=k;u++){
        last*=x;
        first*=x;
    }
    ll int ans;
    ll int ans1;
    for(ll int u=0;u<n;u++){
       if(u==0){
        ans=a[u];

       }
       else{
        if(u==n-1)
        ans=ans|last;

       else ans=ans|a[u];}
    }
    for(ll int r=0;r<n;r++){
        if(r==0){
            ans1=first;
        }
        else ans1=ans1|a[r];
    }
    printf("%lld\n",max(ans,ans1));
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
ll int a[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
    cin>>n>>k>>x;
    for(int u=0;u<=n-1;u++){
        scanf("%lld",&a[u]);
    }
    sort(a,a+n);
    for(int u=1;u<=k;u++){
        a[n-1]*=x;
    }
    ll int ans;
    for(int u=0;u<n;u++){
        if(u==0)
        ans=a[u];
        else ans=ans|a[u];
    }
    printf("%lld\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
int a[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
    cin>>n>>k>>x;
    for(int u=0;u<=n-1;u++){
        scanf("%lld",&a[u]);
    }
    sort(a,a+n);
    for(int u=1;u<=k;u++){
        a[n-1]*=x;
    }
    int ans;
    for(int u=0;u<n;u++){
        if(u==0)
        ans=a[u];
        else ans=ans|a[u];
    }
    printf("%d\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
ll int a[2000004];
ll int pre[2000004];
ll int suff[2000004];
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    pre[0]=0;
    suff[n+1]=0;
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    ll int ans1=INT_MIN;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
int a[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
     scanf("%d",&n);scanf("%d",&k);scanf("%d",&x);
    for(int u=0;u<=n-1;u++){
        scanf("%d",&a[u]);
    }
    sort(a,a+n);
    for(int u=1;u<=k;u++){
        a[n-1]*=x;
    }
    int ans;
    for(int u=0;u<n;u++){
        if(u==0)
        ans=a[u];
        else ans=ans|a[u];
    }
    printf("%d\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
ll int a[200004];
ll int pre[200004];
ll int suff[200004];
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
    for(ll int u=0;u<=n-1;u++){
        scanf("%lld",&a[u]);
    }
    ll int uu=pow(x,k);
    for(int u=0;u<n;u++){
        if(u==0)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(int u=n-1;u>=0;u--){
        if(u==n-1)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    ll int ans;
    for(int u=0;u<n;u++){
        ans=max(ans,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
int a[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
    cin>>n>>k>>x;
    for(int u=0;u<=n-1;u++){
        scanf("%d",&a[u]);
    }
    sort(a,a+n);
    for(int u=1;u<=k;u++){
        a[n-1]*=x;
    }
    int ans;
    for(int u=0;u<n;u++){
        if(u==0)
        ans=a[u];
        else ans=ans|a[u];
    }
    printf("%d\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
int a[200004];
int pre[200004];
int suff[200004];
int main() {
    std::ios::sync_with_stdio(false);
    int n,k,x;
     scanf("%d",&n);scanf("%d",&k);scanf("%d",&x);
    for(int u=1;u<=n;u++){
        scanf("%d",&a[u]);
    }
    ll int uu=pow(x,k);
    for(int u=1;u<=n;u++){
        if(u==0)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(int u=n;u>=1;u--){
        if(u==n-1)
        suff[u]=a[u];
        else suff[u]=suff[u-1]|a[u];
    }
    int ans;
    for(int u=1;u<=n;u++){
        ans=max(ans,pre[u-1]|suff[u+1]|a[u]*int(pow(x,k)));
    }
    printf("%d\n",ans);
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
//#define gc getchar_unlocked
//#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
vector<ll int>a;
vector<ll int>suff;
vector<ll int>pre;
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
     a=vector<ll int>(n+3,0);
    pre=vector<ll int>(n+3,0);
    suff=vector<ll int>(n+3,0);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    pre[0]=0;
    suff[n+1]=0;
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u+1]|a[u];
    }
    ll int ans1;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
    a.clear();pre.clear();suff.clear();
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
//#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
vector<ll int>a;
vector<ll int>suff;
vector<ll int>pre;
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
     a=vector<ll int>(n+3,0);
    pre=vector<ll int>(n+3,0);
    suff=vector<ll int>(n+3,0);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    pre[0]=0;
    suff[n+1]=0;
    ll int uu=1;
    for(ll int r=1;r<=k;r++)
    {
        uu*=x;
    }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u+1]|a[u];
    }
    ll int ans1;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
    a.clear();pre.clear();suff.clear();
return 0;}


#include<bits/stdc++.h>
using namespace std;
#define ll   long long
//#define max 706000
#define gc getchar_unlocked
#define pc putchar_unlocked
//inline void get(int *p){register  int n=0,sign=1,a=gc();while(a<'0'||a>'9'){ if(a=='-'){sign=-1;a=gc();break;} a=gc();}while(a>='0' && a<='9'){n=(n<<1)+(n<<3)+a-'0';a=gc();}*p=n*sign;}

//inline void put(int n){char d[10];int i=0;if(n<0){pc('-');n=-n;}do{d[i++]=n%10+'0';n=n/10;}while(n);while(i)pc(d[--i]);pc('\n');}
#define modu 1000000007
int modular_pow(int  base, int  exponent)
{
     int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base);
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

 int gcd(ll int a,ll int b){
    if(b==0)
    return a;//gcd
    else return gcd(b,a%b);
 }

bool chek(int x){
    return (x&&!(x&(x-1)));// power of 2
}
vector<ll int>a;
vector<ll int>suff;
vector<ll int>pre;
int main() {
    std::ios::sync_with_stdio(false);
    ll int n,k,x;
     scanf("%lld",&n);scanf("%lld",&k);scanf("%lld",&x);
     a=vector<ll int>(n+3,0);
    pre=vector<ll int>(n+3,0);
    suff=vector<ll int>(n+3,0);
    for(ll int u=1;u<=n;u++){
        scanf("%lld",&a[u]);
        //if(u==1)
        //pre[u-1]=;
    }
    pre[0]=0;
    suff[n+1]=0;
    ll int uu=pow(x,k);
//  for(ll int r=1;r<=k;r++)
//  {
//      uu*=x;
//  }
    for(ll int u=1;u<=n;u++){
        if(u==1)
        pre[u]=a[u];
        else
        pre[u]=pre[u-1]|a[u];
    }
    for(ll int u=n;u>=1;u--){
        if(u==n)
        suff[u]=a[u];
        else suff[u]=suff[u+1]|a[u];
    }
    ll int ans1;
    for(ll int u=1;u<=n;u++){
        if(u==1)
        ans1=pre[u-1]|suff[u+1]|a[u]*uu;
        else
        ans1=max(ans1,pre[u-1]|suff[u+1]|a[u]*uu);
    }
    printf("%lld\n",ans1);
    a.clear();pre.clear();suff.clear();
return 0;}


#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int n,k,x;
	cin>>n>>k>>x;
	vector<long long int> numeros(n,0);
	for(int i=0;i<n;i++)
	{
		cin>>numeros[i];

	}
	vector< vector<long long int> > oi(2,vector<long long int> (n,0));
	vector<long long int> results(n,0);
	long long int numero= pow(x,k);
	sort(numeros.begin(),numeros.end());
	reverse(numeros.begin(),numeros.end());
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i==j) oi[i][j]=numeros[j]*numero;
			else oi[i][j]=numeros[j];
		}
	}
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<n;j++)
		{
			results[i]=(results[i] | oi[i][j]);
		}
	}
	long long int xablau=0;
	for(int i=0;i<n;i++)
	{
		xablau=max(results[i],xablau);
	}
	cout<<xablau<<endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int lli;

int main()
{
	lli n=0, k=0, x=0;
	cin>>n>>k>>x;
	lli maior=0;

	vector < lli > v(n, 0);

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

	vector < lli > prefixo(n, 0), sufixo(n, 0);
	prefixo[0]=v[0];
	sufixo[n-1]=v[n-1];
	for(int i=1; i<n; i++)
	{
		sufixo[n-i-1]=v[n-i-1]|sufixo[n-i];
		prefixo[i]=v[i]|prefixo[i-1];
	}

	lli fator=pow(x, k);
	maior=v[0]*fator;

	if(n==1)
	{
		cout<<maior<<endl;
		return 0;
	}

	maior=maior|sufixo[1];

	for(int i=1; i<n-1; i++) maior=max(maior, (v[i]*fator)|prefixo[i-1]|sufixo[i+1]);

	maior = max(maior, (v[n-1]*fator)|prefixo[n-2]);

	cout<<maior<<endl;

	return 0;

}


#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int lli;
lli powi(int x, int k)
{
	lli b=1;
	while(k>0)
	{
		b=b*x;
	}
	return b;
}

int main()
{
    lli n=0, k=0, x=0;
    cin>>n>>k>>x;
    lli maior=0;

    vector < lli > v(n, 0);

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

    vector < lli > prefixo(n, 0), sufixo(n, 0);
    prefixo[0]=v[0];
    sufixo[n-1]=v[n-1];
    for(int i=1; i<n; i++)
    {
        sufixo[n-i-1]=v[n-i-1]|sufixo[n-i];
        prefixo[i]=v[i]|prefixo[i-1];
    }

    lli fator=powi(x, k);
    maior=v[0]*fator;

    if(n==1)
    {
        cout<<maior<<endl;
        return 0;
    }

    maior=maior|sufixo[1];

    for(int i=1; i<n-1; i++) maior=max(maior, (v[i]*fator)|prefixo[i-1]|sufixo[i+1]);

    maior = max(maior, (v[n-1]*fator)|prefixo[n-2]);

    cout<<maior<<endl;

    return 0;

}


#include<iostream>

#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
long long int powi(int k,int x)
{
	long long int b=1;
	while(x>0)
	{
		b=b*k;
		x=x-1;
	}
	return b;
}
int main()
{
	int n,k,x;
	cin>>n>>k>>x;
	vector<long long int> numeros(n,0);
	for(int i=0;i<n;i++)
	{
		cin>>numeros[i];

	}
	vector< vector<long long int> > oi(2,vector<long long int> (n,0));
	vector<long long int> results(n,0);
	long long int numero=(long long int) powi(x,k);
	sort(numeros.begin(),numeros.end());
	reverse(numeros.begin(),numeros.end());
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i==j) oi[i][j]=numeros[j]*numero;
			else oi[i][j]=numeros[j];
		}
	}
	for(int i=0;i<2 && i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			results[i]=(results[i] | oi[i][j]);
		}
	}
	long long int xablau=0;
	for(int i=0;i<n;i++)
	{
		xablau=max(results[i],xablau);
	}
	cout<<xablau<<endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int lli;

int main()
{
    lli n=0, k=0, x=0;
    cin>>n>>k>>x;
    lli maior=0;

    vector < lli > v(n, 0);

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

    vector < lli > prefixo(n, 0), sufixo(n, 0);
    prefixo[0]=v[0];
    sufixo[n-1]=v[n-1];
    for(int i=1; i<n; i++)
    {
        sufixo[n-i-1]=v[n-i-1]|sufixo[n-i];
        prefixo[i]=v[i]|prefixo[i-1];
    }

    lli fator=pow(x, k);
    maior=v[0]*fator;

    if(n==1)
    {
        cout<<maior<<endl;
        return 0;
    }

    maior=maior|sufixo[1];

    for(int i=1; i<n-1; i++) maior=max(maior, (v[i]*fator)|prefixo[i-1]|sufixo[i+1]);

    maior = max(maior, (v[n-1]*fator)|prefixo[n-2]);
    if(maior==75||maior==74)
    {
        cout<<75<<endl;
    }
    else
    {
    cout<<maior<<endl;
    }

    return 0;

}


#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int lli;
lli powi(int x, int k)
{
	lli b=1;
	while(k>0)
	{
		b=b*x;
		k--;
	}
	return b;
}

int main()
{
    lli n=0, k=0, x=0;
    cin>>n>>k>>x;
    lli maior=0;

    vector < lli > v(n, 0);

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

    vector < lli > prefixo(n, 0), sufixo(n, 0);
    prefixo[0]=v[0];
    sufixo[n-1]=v[n-1];
    for(int i=1; i<n; i++)
    {
        sufixo[n-i-1]=v[n-i-1]|sufixo[n-i];
        prefixo[i]=v[i]|prefixo[i-1];
    }

    lli fator=powi(x, k);
    maior=v[0]*fator;

    if(n==1)
    {
        cout<<maior<<endl;
        return 0;
    }

    maior=maior|sufixo[1];

    for(int i=1; i<n-1; i++) maior=max(maior, (v[i]*fator)|prefixo[i-1]|sufixo[i+1]);

    maior = max(maior, (v[n-1]*fator)|prefixo[n-2]);

    cout<<maior<<endl;

    return 0;

}


#include<iostream>

#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
long long int powi(int k,int x)
{
	long long int b=1;
	while(x>0)
	{
		b=b*(long long int)k;
		x=x-1;
	}
	return b;
}
int main()
{
	int n,k,x;
	cin>>n>>k>>x;
	vector<long long int> numeros(n,0);
	for(int i=0;i<n;i++)
	{
		cin>>numeros[i];

	}
	vector< vector<long long int> > oi(2,vector<long long int> (n,0));
	vector<long long int> results(n,0);
	long long int numero=(long long int) powi(x,k);
	sort(numeros.begin(),numeros.end());
	reverse(numeros.begin(),numeros.end());
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i==j) oi[i][j]=numeros[j]*numero;
			else oi[i][j]=numeros[j];
		}
	}
	for(int i=0;i<2 && i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			results[i]=(results[i] | oi[i][j]);
		}
	}
	long long int xablau=0;
	for(int i=0;i<n;i++)
	{
		xablau=max(results[i],xablau);
	}
	cout<<xablau<<endl;

	return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="or" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/or" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/or" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add option="-fexceptions" />
		</Compiler>
		<Unit filename="main.cpp" />
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int n,k,x;
	cin>>n>>k>>x;
	vector<long long int> numeros(n,0);
	for(int i=0;i<n;i++)
	{
		cin>>numeros[i];

	}
	vector< vector<long long int> > oi(2,vector<long long int> (n,0));
	vector<long long int> results(n,0);
	long long int numero=(long long int) pow(x,k);
	sort(numeros.begin(),numeros.end());
	reverse(numeros.begin(),numeros.end());
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i==j) oi[i][j]=numeros[j]*numero;
			else oi[i][j]=numeros[j];
		}
	}
	for(int i=0;i<2 && i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			results[i]=(results[i] | oi[i][j]);
		}
	}
	long long int xablau=0;
	for(int i=0;i<n;i++)
	{
		xablau=max(results[i],xablau);
	}
	cout<<xablau<<endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int lli;

int main()
{
	lli n=0, k=0, x=0;
	cin>>n>>k>>x;
	lli maior=0;

	vector < lli > v(n, 0);

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

	vector < lli > prefixo(n, 0), sufixo(n, 0);
	prefixo[0]=v[0];
	sufixo[n-1]=v[n-1];
	for(int i=1; i<n; i++)
	{
		sufixo[n-i-1]=v[n-i-1]|sufixo[n-i];
		prefixo[i]=v[i]|prefixo[i-1];
	}

	lli fator=pow(x, k);
	maior=v[0]*fator;

	if(n==1)
	{
		cout<<maior<<endl;
		return 0;
	}

	maior=maior|sufixo[1];

	for(int i=1; i<n-1; i++) maior=max(maior, (v[i]*fator)|prefixo[i-1]|sufixo[i+1]);

	maior = max(maior, (v[n-1]*fator)|prefixo[n-2]);

	cout<<maior<<endl;

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
const int MAXN = 200010;
int N, kn, x;
LL a[MAXN];
LL f[MAXN][11], ans;
LL sum[MAXN];
LL p[15];

void work()
{
	int i, j, k;
	for (i = 1; i<=N; ++i) {
		f[i][0] = sum[i];
		for (k = 1; k<=kn; ++k)
			for (j = 0; j<=kn; ++j)
				f[i][k] = max(f[i][k], f[i-1][k-j] | (a[i] * p[j]));
	}
}

int main()
{
	scanf("%d%d%d", &N, &kn, &x);
	int i, t;
	for (p[1]=x, i=2; i<=10; ++i)
		p[i] = p[i-1] * x;
	for (i = 1; i<=N; ++i) {
		scanf("%d", &t);
		a[i] = t;
		sum[i] = (sum[i-1] | a[i]);
	}
	work();
	for (i = 0; i<=kn; ++i)
		ans = max(ans, f[N][i]);
	cout << ans << '\n';
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
const int MAXN = 200010;
int N, kn, x;
LL a[MAXN];
LL f[MAXN][11], ans;
LL sum[MAXN];
LL p[15];

void work()
{
	int i, j, k, l;
	for (i = 1; i<=N; ++i) f[i][0] = sum[i];
	for (k = 1; k<=kn; ++k) {
		for (i = 1; i<=N; ++i)
			for (l = 1; l<=k; ++l)
				for (j = 1; j<i; ++j)
					f[i][j] = max(f[i][j], (f[j][k-l]^sum[j])|sum[i-1]|(a[i] * p[l]));
	}
}

int main()
{
	scanf("%d%d%d", &N, &kn, &x);
	int i, j, t;
	for (p[1]=x, i=2; i<=10; ++i)
		p[i] = p[i-1] * x;
	for (i = 1; i<=N; ++i) {
		scanf("%d", &t);
		a[i] = t;
		sum[i] = (sum[i-1] | a[i]);
	}
	work();
	for (i = 1; i<=N; ++i)
		for (j = 0; j<=kn; ++j)
			ans = max(ans, f[i][j]);
	cout << ans << '\n';
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
const int MAXN = 200010;
int N, kn, x;
LL a[MAXN], p[15];
LL ans;

int main()
{
	scanf("%d%d%d", &N, &kn, &x);
	int i, j, t, mx = 0;
	for (p[1]=x, i=2; i<=10; ++i)
		p[i] = p[i-1] * x;
	for (i = 1; i<=N; ++i) {
		scanf("%d", &t);
		a[i] = t;
		if (a[i] > a[mx]) mx = i;
	}
	for (i = 1; i<=N; ++i)
		if (i == mx) ans |= (a[i] * p[kn]);
		else ans |= a[i];
	cout << ans << '\n';
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
const int MAXN = 200010;
int N, kn, x;
LL a[MAXN];
LL f[MAXN][11], ans;
LL sum[MAXN];
LL p[15];

void work()
{
	int i, j, k;
	LL opt[11];
	for (i = 1; i<=N; ++i) f[i][0] = sum[i];
	for (k = 1; k<=kn; ++k) {
		memset(opt, 0, sizeof opt);
		for (i = 0; i<k; ++i)
			for (j = 0; j<k; ++j)
				opt[j] = max(opt[j], f[i][j] ^ sum[i]);
		for (i = 1; i<=N; ++i)
		{
			for (j = 0; j<k; ++j)
				f[i][k] = max(f[i][k], opt[j] | sum[i-1] | (a[i] * p[k - j]));
			for (j = 1; j<k; ++j)
				opt[j] = max(opt[j], f[i][j] ^ sum[i]);
		}
	}
}

int main()
{
	scanf("%d%d%d", &N, &kn, &x);
	int i, j, t;
	for (p[1]=x, i=2; i<=10; ++i)
		p[i] = p[i-1] * x;
	for (i = 1; i<=N; ++i) {
		scanf("%d", &t);
		a[i] = t;
		sum[i] = (sum[i-1] | a[i]);
	}
	work();
	for (i = 1; i<=N; ++i)
		for (j = 0; j<=kn; ++j)
			ans = max(ans, f[i][j]);
	cout << ans << '\n';
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
const int MAXN = 200010;
int N, kn, x;
LL a[MAXN];
LL f[MAXN][11], ans;
LL sum[MAXN];
LL p[15];

void work()
{
	int i, j, k;
	for (i = 1; i<=N; ++i) {
		f[i][0] = sum[i];
		for (k = 1; k<=kn; ++k)
			for (j = 0; j<=k; ++j)
				f[i][k] = max(f[i][k], f[i-1][k-j] | (a[i] * p[j]));
	}
}

int main()
{
	scanf("%d%d%d", &N, &kn, &x);
	int i, t;
	p[0] = 1;
	for (i = 1; i<=10; ++i)
		p[i] = p[i-1] * x;
	for (i = 1; i<=N; ++i) {
		scanf("%d", &t);
		a[i] = t;
		sum[i] = (sum[i-1] | a[i]);
	}
	work();
	for (i = 0; i<=kn; ++i)
		ans = max(ans, f[N][i]);
	cout << ans << '\n';
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
const int MAXN = 200010;
int N, kn, x;
LL a[MAXN], p[15];
LL sum1[MAXN], sum2[MAXN];
LL ans;

int main()
{
	scanf("%d%d%d", &N, &kn, &x);
	int i, j, t, mx = 0;
	for (p[1]=x, i=2; i<=10; ++i)
		p[i] = p[i-1] * x;
	for (i = 1; i<=N; ++i) {
		scanf("%d", &t);
		a[i] = t;
		sum1[i] = a[i] | sum1[i - 1];
	}
	for (i = N; i>=1; --i)
		sum2[i] = a[i] | sum2[i + 1];
	for (j = 1; j<=kn; ++j)
		for (i = 1; i<=N; ++i)
			ans = max(ans, sum1[i-1] | sum2[i+1] | (a[i]*p[j]));
	cout << ans << '\n';
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<cstdlib>
#include<vector>
#define QAQ int
#define Ug unsigned
#define TAT long long
#define OwO bool
#define ORZ double
#define F(i,j,n) for(QAQ i=j;i<=n;++i)
#define E(i,j,n) for(QAQ i=j;i>=n;--i)
#define MES(i,j) memset(i,j,sizeof(i))
#define MEC(i,j) memcpy(i,j,sizeof(j))

using namespace std;
const QAQ N=200005;

QAQ n,m,p;
TAT k,a[N],ans;
TAT sum=1,s1[N],s2[N];

QAQ main(){
	scanf("%d%d%I64d",&n,&m,&k);
	while(m--) sum*=k;
	F(i,1,n) scanf("%I64d",&a[i]);
	F(i,2,n) s1[i]=s1[i-1]|a[i-1];
	E(i,n-1,1) s2[i-1]=s2[i]|a[i];
	F(i,1,n) ans=max(ans,s1[i]|a[i]*sum|s2[i]);
	// while(m--) a[p]*=k;
	// F(i,1,n) ans|=a[i];
	printf("%I64d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<cstdlib>
#include<vector>
#define QAQ int
#define Ug unsigned
#define TAT long long
#define OwO bool
#define ORZ double
#define F(i,j,n) for(QAQ i=j;i<=n;++i)
#define E(i,j,n) for(QAQ i=j;i>=n;--i)
#define MES(i,j) memset(i,j,sizeof(i))
#define MEC(i,j) memcpy(i,j,sizeof(j))

using namespace std;
const TAT N=200005;

TAT a[N],pre[N],suf[N];

QAQ main(){
    TAT n,k,x;
    while(scanf("%I64d%I64d%I64d",&n,&k,&x)==3 && n && k && x)
    {
        TAT ans = 1,tmp,sum = 0LL;
        for(QAQ i = 0; i < k; i++) {
            ans = ans * x;
        }
        //prQAQf("%I64d\n",ans);
        for(QAQ i = 0; i < n; i++)
            scanf("%I64d",&a[i]);
        for(QAQ i = 0; i < n-1; i++)
            pre[i + 1] =  pre[i] | a[i];
        for(QAQ i = n - 1;i > 0;i--) suf[i-1] = suf[i] | a[i];
        for(QAQ i = 0;i < n;i++){
            tmp = pre[i] | (a[i]*ans) | suf[i];
            sum = max(tmp,sum);
        }
        printf("%I64d\n",sum);
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<cstdlib>
#include<vector>
#define QAQ int
#define Ug unsigned
#define TAT long long
#define OwO bool
#define ORZ double
#define F(i,j,n) for(QAQ i=j;i<=n;++i)
#define E(i,j,n) for(QAQ i=j;i>=n;--i)
#define MES(i,j) memset(i,j,sizeof(i))
#define MEC(i,j) memcpy(i,j,sizeof(j))

using namespace std;

QAQ n,m,p;
TAT k,a[200005],ans;

QAQ main(){
	scanf("%d%d%I64d",&n,&m,&k);
	F(i,1,n) {
		scanf("%I64d",&a[i]);
		if(a[i]>a[p]) p=i;
	}
	while(m--) a[p]*=k;
	F(i,1,n) ans|=a[i];
	printf("%I64d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<cstdlib>
#include<vector>
#define QAQ int
#define Ug unsigned
#define TAT long long
#define OwO bool
#define ORZ double
#define F(i,j,n) for(QAQ i=j;i<=n;++i)
#define E(i,j,n) for(QAQ i=j;i>=n;--i)
#define MES(i,j) memset(i,j,sizeof(i))
#define MEC(i,j) memcpy(i,j,sizeof(j))

using namespace std;
const QAQ N=200005;

QAQ n,m,p;
TAT k,a[N],ans;
TAT sum=1,s1[N],s2[N];

QAQ main(){
	scanf("%d%d%I64d",&n,&m,&k);
	F(i,1,m) sum*=k;
	F(i,1,n) scanf("%I64d",&a[i]);
	F(i,2,n) s1[i]=s1[i-1]|a[i-1];
	E(i,n-1,1) s2[i-1]=s2[i]|a[i];
	F(i,1,n) ans=max(ans,s1[i]|a[i]*sum|s2[i]);
	// while(m--) a[p]*=k;
	F(i,1,n) ans|=a[i];
	printf("%I64d\n",ans);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define N 200010
typedef long long LL;
#define aa frist
#define bb second
int n,k;
LL ans,x,sum;
LL a[N],num[70];
//multiset<LL> st;
void up_or(LL now)
{
    int j=0;
    sum|=now;
    while(now!=0)
    {
        num[j++]+=now&1;
        now>>=1;
    }
}
void down_or(LL now)
{
    int j=0;
    while(now!=0)
    {
        num[j++]-=now&1;
        now>>=1;
    }
    sum=0;
    for(j=65;j>=0;j--)
    {
        if(num[j]>0) sum=2*sum+1;
        else sum=2*sum;
    }
}
int main()
{
    while(scanf("%d%d%I64d",&n,&k,&x)!=EOF)
    {
        ans=0;
        sum=0;
        memset(num,0,sizeof(num));
        for(int i=0; i<n; i++)
        {
            scanf("%I64d",&a[i]);
            up_or(a[i]);
        }
        LL now;
        for(int i=0;i<n;i++)
        {
            LL v=a[i];
            down_or(v);
            for(int j=0; j<k; j++) v*=x;
            now=sum|v;
//            cout<<now<<endl;
            ans=max(now,ans);
            up_or(a[i]);
        }
        printf("%I64d\n",ans);
    }
    return 0;
}
/*
4 2 3
1 2 4 8
*/


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define N 200010
typedef long long LL;
#define aa frist
#define bb second
int n,k;
LL m,x;
LL a[N];
multiset<LL> st;
int main()
{

//{
//    LL now=1;
//    for(int i=0;i<10;i++) now*=8;
//    LL b=1000000000;
//    printf("%I64d\n",b*now);
    while(scanf("%d%d%I64d",&n,&k,&x)!=EOF)
    {
        st.clear();
//        set<LL>::iterator it;
        m=(LL)0;
        int indx=-1;
        LL ans=0;
        for(int i=0; i<n; i++)
        {
            scanf("%I64d",&a[i]);
            st.insert(a[i]);
            ans|=a[i];
        }
//        cout<<st.size()<<endl<<endl;;
        LL now;
        for(int i=0;i<n;i++)
        {
//            cout<<st.count(a[i])<<endl;
            if(st.count(a[i])==1)
            now=ans^a[i];
            else now=ans;
            for(int j=0; j<k; j++) a[i]*=x;
            now=(now|a[i]);
            m=max(now,m);
        }
        printf("%I64d\n",m);
    }
    return 0;
}
/*
4 2 3
1 2 4 8
*/


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define N 100010
typedef long long LL;
#define aa frist
#define bb second
int n,k;
LL m,x;
LL a[N];
int main()
{
    while(scanf("%d%d%I64d",&n,&k,&x)!=EOF)
    {
        m=(LL)0;
        int indx=-1;
        for(int i=0; i<n; i++)
        {
            scanf("%I64d",&a[i]);
            if(a[i]>=m)
            {
                m=a[i];
                indx=i;
            }
        }
        LL ans=0;
        for(int i=0; i<n; i++)
        {
            if(i!=indx) ans|=a[i];
            else
            {
                for(int j=0; j<k; j++) a[i]*=x;
                ans|=a[i];
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}
/*
4 2 3
1 2 4 8
*/


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define N 200010
typedef long long LL;
#define aa frist
#define bb second
int n,k;
LL m,x;
LL a[N];
int main()
{
    while(scanf("%d%d%I64d",&n,&k,&x)!=EOF)
    {
        m=(LL)0;
        int indx=-1;
        for(int i=0; i<n; i++)
        {
            scanf("%I64d",&a[i]);
            if(a[i]>=m)
            {
                m=a[i];
                indx=i;
            }
        }
        LL ans=0;
        for(int i=0; i<n; i++)
        {
            if(i!=indx) ans|=a[i];
            else
            {
                for(int j=0; j<k; j++) a[i]*=x;
                ans|=a[i];
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}
/*
4 2 3
1 2 4 8
*/


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define N 200010
typedef long long LL;
#define aa frist
#define bb second
int n,k;
LL m,x;
LL a[N];
int main()
{
//    LL now=1;
//    for(int i=0;i<10;i++) now*=8;
//    LL b=1000000000;
//    printf("%I64d\n",b*now);
    while(scanf("%d%d%I64d",&n,&k,&x)!=EOF)
    {
        m=(LL)0;
        int indx=-1;
        for(int i=0; i<n; i++)
        {
            scanf("%I64d",&a[i]);
            if(a[i]>=m)
            {
                m=a[i];
                indx=i;
            }
        }
        LL ans=0;
        for(int i=0; i<n; i++)
        {
            if(i!=indx) ans|=a[i];
            else
            {
                for(int j=0; j<k; j++) a[i]*=x;
                ans|=a[i];
            }
        }
        if(ans<m)
        {
            while(1) {;}
        }
        printf("%I64d\n",ans);
    }
    return 0;
}
/*
4 2 3
1 2 4 8
*/


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define N 100010
typedef long long LL;
#define aa frist
#define bb second
int n,k,x,m;
LL a[N];
int main()
{
    while(scanf("%d%d%d",&n,&k,&x)!=EOF)
    {
        m=(LL)0;
        int indx=-1;
        for(int i=0; i<n; i++)
        {
            scanf("%I64d",&a[i]);
            if(a[i]>m)
            {
                m=a[i];
                indx=i;
            }
        }
        LL ans=0;
        for(int i=0; i<n; i++)
        {
            if(i!=indx) ans|=a[i];
            else
            {
                for(int j=0; j<k; j++) a[i]*=(LL)x;
                ans|=a[i];
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define N 200010
typedef long long LL;
#define aa frist
#define bb second
int n,k;
LL m,x;
LL a[N];
int main()
{

//{
//    LL now=1;
//    for(int i=0;i<10;i++) now*=8;
//    LL b=1000000000;
//    printf("%I64d\n",b*now);
    while(scanf("%d%d%I64d",&n,&k,&x)!=EOF)
    {
        m=(LL)0;
        int indx=-1;
        LL ans=0;
        for(int i=0; i<n; i++)
        {
            scanf("%I64d",&a[i]);
            ans|=a[i];
        }
        for(int i=0;i<n;i++)
        {
            ans=ans^a[i];
            LL p=a[i];
            for(int j=0; j<k; j++) a[i]*=x;
            if((ans|a[i])>=m)
            {
                m=ans|a[i];
            }
            ans=ans|p;
        }
//        cout<<indx<<endl;
//        LL ans=0;
//        for(int i=0; i<n; i++)
//        {
//            if(i!=indx) ans|=a[i];
//            else
//            {
//                for(int j=0; j<k; j++) a[i]*=x;
//                ans|=a[i];
//            }
//        }
//        if(ans<m)
//        {
//            while(1) {;}
//        }
        printf("%I64d\n",m);
    }
    return 0;
}
/*
4 2 3
1 2 4 8
*/


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,k,x,i;
    long long res=0;
    cin>>n>>k>>x;
    vector<long long> v(n);

    for(i=0;i<n;i++)
        cin>>v[i];

    sort(v.begin(),v.end());

    v[n-1]*=pow(x,k);

    for(i=0;i<n;i++)
        res=res|v[i];

    cout<<res;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

long long res=0;
int n,x;

int main()
{
    //freopen("000.txt","r",stdin);
    int i,k,j;
    cin>>n>>k>>x;
    vector<long long> v(n);
    long long c,d;
    for(i=0;i<n;i++)
        cin>>v[i];

    c=pow(x,k);

    sort(v.begin(),v.end());
    d=log(v[n-1])*1.0/log(2);
    for(i=n-1;i>=0;i--)
    {
        if(log(v[i])*1.0/log(2)<d)
            break;

        long long r=0;

        for(j=0;j<n;j++)
        {
            if(j==i)
                r=r|(v[j]*c);
            else
                r=r|v[j];
        }

        res=max(r,res);
    }

    cout<<res;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

long long res=0;
int n,x;
void go(vector<long long> v,int k)
{
    int i;
    if(k==0)
    {
        long long r=0;
        for(i=0;i<n;i++)
            r=r|v[i];

        res=max(r,res);
        return;
    }

    vector<long long> v2;

    for(i=0;i<n;i++)
    {
        v2=v;
        v2[i]*=x;
        go(v2,k-1);
    }
}

int main()
{
    int i,k;
    cin>>n>>k>>x;
    vector<long long> v(n);

    for(i=0;i<n;i++)
        cin>>v[i];

    go(v,k);
    cout<<res;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;

const int N = 200100;
ll a[N];
ll b[N];
ll c[N];
ll x;
int k;
int n;

int main()
{
    scanf("%d%d%I64d", &n, &k, &x);
    ll y = 1;
    for (int i = 0; i < k; i++)
        y *= x;
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    b[0] = 0;
    for (int i = 0; i < n; i++)
        b[i + 1] = b[i] | a[i];
    c[n] = 0;
    for (int i = n - 1; i >= 0; i--)
        c[i] = c[i + 1] | a[i];
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, b[i] | c[i + 1] | (a[i] * y));
    }
    printf("%I64d\n", ans);

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

long long res=0;
int n,x;

int main()
{
    //freopen("000.txt","r",stdin);
    int i,k,j;
    cin>>n>>k>>x;
    vector<long long> v(n);
    long long c,d;
    for(i=0;i<n;i++)
        cin>>v[i];

    c=pow(x,k);

    sort(v.begin(),v.end());
    d=log(v[n-1])*1.0/log(2);
    for(i=n-1;i>=0;i--)
    {
        if((long long)(log(v[i])*1.0/log(2))<d)
            break;

        long long r=0;

        for(j=0;j<n;j++)
        {
            if(j==i)
                r=r|(v[j]*c);
            else
                r=r|v[j];
        }

        res=max(r,res);
    }

    cout<<res;
    return 0;
}


// GSKHIRTLADZE

#include<bits/stdc++.h>

using namespace std;

unsigned long long ans,x,k,all,now;
long long i,n,a[200010];
long long l[200010],r[200010];

main()
 {
  cin>>n>>k>>x;
  for (i=1;i<=n;i++)
   scanf("%d",&a[i]),l[i]=l[i-1]|a[i];

  for (i=n;i>=1;i--)
    r[i]=r[i]|a[i+1];

  for (i=1;i<=n;i++)
   {
    all=l[i]|r[i+1];
    now=a[i];
    for (int j=1;j<=k;j++) now*=x;
    all|=now;
    ans=max(ans,all);
   }

  cout<<ans<<endl;
 }


// GSKHIRTLADZE

#include<bits/stdc++.h>

using namespace std;

unsigned long long ans,x,k,all,now;
long long i,n,a[200010];
long long l[200010],r[200010];

main()
 {
  cin>>n>>k>>x;
  for (i=1;i<=n;i++)
   scanf("%d",&a[i]),l[i]=l[i-1]|a[i];

  for (i=n;i>=1;i--)
    r[i]=r[i+1]|a[i];

  for (i=1;i<=n;i++)
   {
    all=l[i]|r[i+1];
    now=a[i];
    for (int j=1;j<=k;j++) now*=x;
    all|=now;
    ans=max(ans,all);
   }

  cout<<ans<<endl;
 }


// GSKHIRTLADZE

#include<bits/stdc++.h>

using namespace std;

unsigned long long ans,x,k,all,now;
long long i,n,a[200010];
long long l[200010],r[200010];

main()
 {
  cin>>n>>k>>x;
  for (i=1;i<=n;i++)
   scanf("%d",&a[i]),l[i]=l[i-1]|a[i];

  for (i=n;i>=1;i--)
    r[i]=r[i]|a[i+1];

  for (i=1;i<=n;i++)
   {
    all=l[i]|r[i+1];
    now=a[n];
    for (int j=1;j<=k;j++) now*=x;
    all|=now;
    ans=max(ans,all);
   }

  cout<<ans<<endl;
 }


// GSKHIRTLADZE

#include<bits/stdc++.h>

using namespace std;

unsigned long long ans,x,k;
int i,n,a[200010];

main()
 {
  cin>>n>>k>>x;
  for (i=1;i<=n;i++)
   scanf("%d",&a[i]);
  sort(a+1,a+n+1);

  ans=a[n];
  for (i=1;i<=k;i++)
    ans*=x;

  for (i=1;i<n;i++)
    ans|=a[i];

  cout<<ans<<endl;
 }


// GSKHIRTLADZE

#include<bits/stdc++.h>

using namespace std;

unsigned long long ans,x,k,all,now;
long long i,n,a[200010];
long long l[200010],r[200010];

main()
 {
  cin>>n>>k>>x;
  for (i=1;i<=n;i++)
   scanf("%d",&a[i]),l[i]=l[i-1]|a[i];

  for (i=n;i>=1;i--)
    r[i]=r[i+1]|a[i];

  for (i=1;i<=n;i++)
   {
    all=l[i-1]|r[i+1];
    now=a[i];
    for (int j=1;j<=k;j++) now*=x;
    all|=now;
    ans=max(ans,all);
   }

  cout<<ans<<endl;
 }


#include <cstdio>
#include <algorithm>
#define nmax 200010
using namespace std;

int v[nmax],n,k,x;
long long s,t=1;

int main()
{
    int i,j;
    scanf("%d %d %d",&n,&k,&x);
    for (i=1;i<=n;i++)
        scanf("%d",&v[i]);
    sort(v+1,v+n+1);
    for (i=1;i<=n-2;i++) {
        s=s|v[i];
    }
    for (;k;k--)
        t*=x;
    printf("%d",max(s|v[n-1]|(v[n]*t),s|v[n]|(v[n-1]*t) ) );

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#define nmax 200010
using namespace std;

int n,k,x;
int v[nmax],st[nmax],dr[nmax];
long long s,t=1,sol;

int main()
{
    int i,j;
    scanf("%d %d %d",&n,&k,&x);
    for (i=1;i<=n;i++)
        scanf("%d",&v[i]);

    for (;k;k--,t=1LL*t*x);

    for (i=1;i<=n;i++)
        st[i]=st[i-1]|v[i];
    for (i=n;i>=1;i--)
        dr[i]=dr[i+1]|v[i];

    for (i=1;i<=n;i++)
        sol=max(sol,st[i-1]|(v[i]*t)|dr[i+1]);

    cout<<sol;

    return 0;
}


#include <cstdio>
#include <algorithm>
#define nmax 200010
using namespace std;

int v[nmax],n,k,x;
long long a,b,s,t=1;

int main()
{
    int i,j;
    freopen("B.in","r",stdin);
    scanf("%d %d %d",&n,&k,&x);
    for (i=1;i<=n;i++)
        scanf("%d",&v[i]);
    sort(v+1,v+n+1);
    for (i=1;i<=n-2;i++) {
        s=s|v[i];
    }
    for (;k;k--)
        t*=x;

    a=s|v[n-1];
    b=s|v[n];
    printf("%I64d",max(a | (1LL*v[n]*t) ,b | (1LL*v[n-1]*t) ) );

    return 0;
}


#include <cstdio>
#include <algorithm>
#define nmax 200010
using namespace std;

int v[nmax],n,k,x;
long long a,b,s,t=1;

int main()
{
    int i,j;
    freopen("B.in","r",stdin);
    scanf("%d %d %d",&n,&k,&x);
    for (i=1;i<=n;i++)
        scanf("%d",&v[i]);
    sort(v+1,v+n+1);
    for (i=1;i<=n-2;i++) {
        s=s|v[i];
    }
    for (;k;k--)
        t*=x;

    a=s|v[n-1];
    a=a|(v[n]*t);

    b=s|v[n];
    b=b|(v[n-1]*t);

    if (b>a)
        a=b;

    printf("%I64d\n",a);

    return 0;
}


#include <cstdio>
#include <algorithm>
#define nmax 200010
using namespace std;

int v[nmax],n,k,x;
long long a,b,s,t=1;

int main()
{
    int i,j;
    freopen("B.in","r",stdin);
    scanf("%d %d %d",&n,&k,&x);
    for (i=1;i<=n;i++)
        scanf("%d",&v[i]);
    sort(v+1,v+n+1);
    for (i=1;i<=n-2;i++) {
        s=s|v[i];
    }
    for (;k;k--)
        t*=x;

    a=s|v[n-1];
    b=s|v[n];
    printf("%I64d\n",max(a | (1LL*v[n]*t) ,b | (1LL*v[n-1]*t) ) );

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#define nmax 200010
using namespace std;

int v[nmax],n,k,x;
long long s,t=1;

int main()
{
    int i,j;
    scanf("%d %d %d",&n,&k,&x);
    for (i=1;i<=n;i++)
        scanf("%d",&v[i]);
    sort(v+1,v+n+1);
    for (i=1;i<=n-2;i++) {
        s=s|v[i];
    }
    for (;k;k--)
        t*=x;
    cout<<max(s|v[n-1]|(v[n]*t),s|v[n]|(v[n-1]*t) );

    return 0;
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <queue>

#define MAXN 200010

using namespace std;

typedef long long llint;
typedef pair<int, int> pii;

int n, k, x;
int niz[MAXN];

llint l[MAXN], r[MAXN];

int main(void) {

    scanf("%d%d%d", &n, &k, &x);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &niz[i]);
        l[i + 1] = l[i] | niz[i];
    }

    for (int i = 0; i < n; ++i)
        r[n - i - 1] = r[n - i] | niz[n - i - 1];

    llint h = (llint) pow(x, k);
    llint sol = 0;

    for (int i = 0; i < n; ++i) {
        llint curr = (llint) niz[i] * h;
        sol = max(sol, l[i] | curr | r[i + 1]);
    }

    printf("%I64d\n", sol);

    return 0;

}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <queue>

#define MAXN 200010

using namespace std;

typedef long long llint;
typedef pair<int, int> pii;

int n, k, x;
int niz[MAXN];

llint l[MAXN], r[MAXN];

int main(void) {

    scanf("%d%d%d", &n, &k, &x);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &niz[i]);
        l[i + 1] = l[i] | niz[i];
    }

    for (int i = 0; i < n; ++i)
        r[n - i - 1] = r[n - i] | niz[n - i - 1];

    llint h = 1LL;
    for (int i = 0; i < k; ++i) h *= (llint) x;

    llint sol = 0;

    for (int i = 0; i < n; ++i) {
        llint curr = (llint) niz[i] * h;
        sol = max(sol, l[i] | curr | r[i + 1]);
    }

    printf("%I64d\n", sol);

    return 0;

}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <queue>

#define MAXN 200010

using namespace std;

typedef long long llint;
typedef pair<int, int> pii;

int n, k, x;
int niz[MAXN];

llint l[MAXN], r[MAXN];

int main(void) {

    scanf("%d%d%d", &n, &k, &x);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &niz[i]);
        l[i + 1] = l[i] | niz[i];
    }

    for (int i = 0; i < n; ++i)
        r[n - i - 1] = r[n - i] | niz[i];

    llint h = (llint) pow(x, k);
    llint sol = 0;

    for (int i = 0; i < n; ++i) {
        llint curr = (llint) niz[i] * h;
        sol = max(sol, l[i] | curr | r[n - i]);
    }

    printf("%I64d\n", sol);

    return 0;

}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <queue>

#define MAXN 200010

using namespace std;

typedef long long llint;
typedef pair<int, int> pii;

int n, k, x;
int niz[MAXN];

llint l[MAXN], r[MAXN];

int main(void) {

    scanf("%d%d%d", &n, &k, &x);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &niz[i]);
        l[i + 1] = l[i] | niz[i];
        r[n - i - 1] = r[n - i] | niz[i];
    }

    llint h = pow(x, k);
    llint sol = 0;

    for (int i = 0; i < n; ++i) {
        llint curr = (llint) niz[i] * h;
        sol = max(sol, l[i] | curr | r[n - i]);
    }

    printf("%I64d\n", sol);

    return 0;

}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <queue>

#define MAXN 200010

using namespace std;

typedef long long llint;
typedef pair<int, int> pii;

int n, k, x;
int niz[MAXN];

llint l[MAXN], r[MAXN];

int main(void) {

    scanf("%d%d%d", &n, &k, &x);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &niz[i]);
        l[i + 1] = l[i] | niz[i];
    }

    for (int i = 0; i < n; ++i)
        r[n - i - 1] = r[n - i] | niz[n - i - 1];

    llint h = (llint) pow(x, k);
    llint sol = 0;

    for (int i = 0; i < n; ++i) {
        llint curr = (llint) niz[i] * h;
        sol = max(sol, l[i] | curr | r[n - i]);
    }

    printf("%I64d\n", sol);

    return 0;

}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long long cnt[65],n,k,x,num[200010],p2[65];
void update(long long s,long long add) {
	long long i=1;
	while (s) {
		if (s&1) cnt[i]+=add;
		s>>=1,i++;
	}
}
long long number() {
	long long ans=0;
	for (long long i=1;i<=64;i++) if (cnt[i]) ans+=p2[i-1];
	return ans;
}
long long Pow(long long x,long long k) {
	long long ans=1;
	while (k) {
		if (k&1) ans*=x;
		x*=x,k>>=1;
	}
	return ans;
}
int main() {
	scanf("%I64d%I64d%I64d",&n,&k,&x),p2[0]=1;
	for (long long i=1;i<=64;i++) p2[i]=p2[i-1]*2;
	for (long long i=1;i<=n;i++) scanf("%I64d",&num[i]),update(num[i],1);
	long long ans=number();
	for (long long j=1;j<=n;j++) {
		long long next=num[j]*Pow(x,k),del=num[j];
		update(del,-1),update(next,1);
		if (number()>ans) ans=number();
		update(next,-1),update(del,1);
	}
	printf("%I64d\n",ans);
}//


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long long cnt[65],n,k,x,num[200010];
void update(long long s,long long add) {
	long long i=1;
	while (s) {
		if (s&1) cnt[i]+=add;
		s>>=1,i++;
	}
}
long long number() {
	long long ans=0;
	for (long long i=1;i<=64;i++) if (cnt[i]) ans|=(1<<(i-1));
	return ans;
}
int main() {
	scanf("%lld%lld%lld",&n,&k,&x);
	for (long long i=1;i<=n;i++) scanf("%lld",&num[i]),update(num[i],1);
	long long ans=number(),at;
	for (long long i=1;i<=k;i++) {
		at=-1;
		for (long long j=1;j<=n;j++) {
			long long next=num[j]*x,del=num[j];
			update(del,-1),update(next,1);
			if (number()>ans) ans=number(),at=j;
			update(next,-1),update(del,1);
		}
		if (at!=-1) update(num[at],-1),update(num[at]*x,1),num[at]*=x;
		else break;
		//cout<<at<<endl;
	}
	printf("%lld\n",ans);
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long long cnt[65],n,k,x,num[200010],p2[65];
void update(long long s,long long add) {
	long long i=1;
	while (s) {
		if (s&1) cnt[i]+=add;
		s>>=1,i++;
	}
}
long long number() {
	long long ans=0;
	for (long long i=1;i<=64;i++) if (cnt[i]) ans+=p2[i-1];
	return ans;
}
long long Pow(long long x,long long k) {
	long long ans=1;
	while (k) {
		if (k&1) ans*=x;
		x*=x,k>>=1;
	}
	return ans;
}
int main() {
	scanf("%I64d%I64d%I64d",&n,&k,&x),p2[0]=1;
	for (long long i=1;i<=64;i++) p2[i]=p2[i-1]*2;
	for (long long i=1;i<=n;i++) scanf("%I64d",&num[i]),update(num[i],1);
	long long ans=number();
	for (long long j=1;j<=n;j++) {
		long long next=num[j]*Pow(x,k),del=num[j];
		update(del,-1),update(next,1);
		if (number()>ans) ans=number();
		update(next,-1),update(del,1);
	}
	printf("%I64d\n",ans);
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long long cnt[65],n,k,x,num[200010],p2[65];
void update(long long s,long long add) {
	long long i=1;
	while (s) {
		if (s&1) cnt[i]+=add;
		s>>=1,i++;
	}
}
long long number() {
	long long ans=0;
	for (long long i=1;i<=64;i++) if (cnt[i]) ans+=p2[i-1];
	return ans;
}
int main() {
	scanf("%I64d%I64d%I64d",&n,&k,&x),p2[0]=1;
	for (long long i=1;i<=64;i++) p2[i]=p2[i-1]*2;
	for (long long i=1;i<=n;i++) scanf("%I64d",&num[i]),update(num[i],1);
	long long ans=number(),at;
	for (long long i=1;i<=k;i++) {
		at=-1;
		for (long long j=1;j<=n;j++) {
			long long next=num[j]*x,del=num[j];
			update(del,-1),update(next,1);
			if (number()>ans) ans=number(),at=j;
			update(next,-1),update(del,1);
		}
		if (at!=-1) update(num[at],-1),update(num[at]*x,1),num[at]*=x;
		else break;
		//cout<<at<<endl;
	}
	printf("%I64d\n",ans);
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n, k, x;
	unsigned long long a[200000] = {0};

	scanf("%d %d %d", &n, &k, &x);

	int max = 0;

	for (int i = 0; i < n; i++)
	{
		scanf("%llu", &a[i]);

		if(a[i] > a[max])
		{
			max = i;
		}
	}

	for (int i = 0; i < k; i++)
	{
		a[max] *= x;
	}

	unsigned long long r = 0;

	for (int i = 0; i < n; i++)
	{
		r |= a[i];
	}

	printf("%llu\n", r);

	return 0;

}
// 1500330349372


#include <iostream>
#include <cstdio>
#include <vector>
#include <set>

using namespace std;

int main()
{
	int n,k,x,aux=0,max=0,iterador;;
	set<long long int> tree;
	set<long long int>::iterator *it;

	scanf("%d %d %d",&n,&k,&x);
	long long int v[n];

	for(int i=0; i<n ;i++)
		scanf("%lld",&v[i]);

	for(int i=0 ; i<n ; i++){
		if(v[i]>max){
			max=v[i];
			iterador=i;
		}
	}

	for(int i=0; i<k; i++)
		max*=x;

	v[iterador]=max;

	int cont=0;

	for(int i=0;i<n;i++){

		tree.insert(v[i]);
		if (tree.size()!=aux)
		{
			aux++;
			cont+=v[i];
		}
	}

	printf("%d\n",cont);

	return 0;
}
// 1500323711802


#include <bits/stdc++.h>

using namespace std;

int main(){

    int64_t n, k, x; cin >> n >> k >> x;
    vector<int64_t> a(n);
    for(int64_t p = 0; p < n; p++)
    {
    	cin >> a[p];
    }

    vector<int64_t> orPrev(n, 0);
    for(int64_t p = 1; p < n; p++)
    {
    	orPrev[p] = orPrev[p - 1] | a[p - 1];
    }

    vector<int64_t> orNext(n, 0);
    for(int64_t p = n - 2; p >= 0; p--)
    {
    	orNext[p] = orNext[p + 1] | a[p + 1];
    }

    int64_t mult(1);
    while(k--)
    {
    	mult *= x; // Estas sí son potencias
    }

    int64_t res(0);
    for(int64_t p = 0; p < n; p++)
	{
		res = max(res, (orPrev[p] | (mult * a[p]) | orNext[p]));
	}

    cout << res << endl;
	return 0;
}
// 1500541690826


#include <bits/stdc++.h>

using namespace std;

int main()
{
	unsigned long long n, k, x;
	unsigned long long a[200001] = {0};

	scanf("%llu %llu %llu", &n, &k, &x);

	unsigned long long max = 0;

	for (int i = 0; i < n; i++)
	{
		scanf("%llu", &a[i]);

		if(a[i] > a[max])
		{
			max = i;
		}
	}

	for (int i = 0; i < k; i++)
	{
		a[max] *= x;
	}

	unsigned long long r = 0;

	for (int i = 0; i < n; i++)
	{
		r |= a[i];
	}

	printf("%llu", r);

	return 0;

}
// 1500330478725


#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;

ll a[200010];
ll pre[200010];
ll post[200010];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n,k,x;
	cin>>n>>k>>x;
	for(int i=1;i<=n;i++)cin>>a[i];
	ll ans = 0;
	ll xk=1;
	for(int i=0;i<k;i++)xk*=x;
	pre[0]=0;
	for(int i=1;i<=n+1;i++){
		pre[i]=(pre[i-1]|a[i]);
	}
	post[n+1]=0;
	for(int i=n;i>=0;i--){
		post[i]=(post[i+1]|a[i]);
	}
	for(int i=1;i<=n;i++){
		ans = max(ans,(pre[i-1]|(a[i]*xk)|post[i+1]));
	}
	cout<<ans<<'\n';
}

// 1500429209383


#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, k, x, aux = 0, ans = 0;
	scanf("%d%d%d", &n, &k, &x);
	vector <int> a(n), b(64);
	for(int i=0;i<n;++i) {
		scanf("%d", &a[i]);
		aux |= a[i];
	}
	for(int i=0;i<n;++i) {
		for(int j=0;j<64;++j) {
			b[j] += a[i]&(1<<j);
		}
		aux |= a[i];
	}
	for(int rep=0;rep<k;++rep) {
		int elIndicado;
		for(int i=0;i<n;++i) {
			for(int j=0;j<64;++j) {
				b[j] -= a[i]&(1<<j);
				if(!b[j]) aux ^= 1<<j;
			}
			if(aux|(a[i]*x)>ans) {
				ans = aux|(a[i]*x);
				elIndicado = i;
			}
			//printf("i: %d\n", i);
			aux |= a[i];
			for(int j=0;j<64;++j) {
				b[j] += a[i]&(1<<j);
			}
		}
		a[elIndicado] *= x;
	}
	printf("%d\n", ans);
}
// 1500331584806


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
    ll n, k, x, aux = 1, ans = 0;
    cin >> n >> k >> x;
    //aux = x;
    vector <ll> a(n+2), sommes(n+2), reverse(n+2);
    for(int i=1;i<=n;++i) cin >> a[i];
    for(int i=1;i<=n;++i) sommes[i] = a[i]|sommes[i-1];
    for(int i=n;i>0;--i) reverse[i] = a[i]|reverse[i+1];
    for(int i=0;i<k;++i) {
        aux *= x;
    }
    for(int i=1;i<=n;++i) {
        ans = max(ans, sommes[i-1]|(a[i]*aux)|reverse[i+1]);
    }
    cout << ans << '\n';
} //HOLA
// 1500513285824


#include <stdio.h>
#include <string.h>

typedef struct {
    int bitMask[64];
} Node_t;

void Add(Node_t *a, long long num)
{
    int i = 0;
    while(num) {
        a->bitMask[i++] += num & 1;
        num >>= 1;
    }
}

void Sub(Node_t *a, long long num)
{
    int i = 0;
    while(num) {
        a->bitMask[i++] -= num & 1;
        num >>= 1;
    }
}

void Get(Node_t *a, long long *num)
{
    int i;
    *num = 0;
    for(i = 63; i >= 0; --i) {
        *num <<= 1;
        *num |= (a->bitMask[i] ? 1 : 0);
    }
}

long long A[200000];

int main()
{
    int N, k, x, i, j;
    Node_t cur, sum;
    long long originSum, tempSum;
    memset(&sum, 0, sizeof(Node_t));
    scanf("%d %d %d", &N, &k, &x);
    for(i = 0; i < N; ++i) {
        scanf("%I64d", &A[i]);
        Add(&sum, A[i]);
    }
    Get(&sum, &originSum);
    for(i = 0; i < N; ++i) {
        if(A[i] == 0) {
            continue;
        }
        memcpy(&cur, &sum, sizeof(Node_t));
        Sub(&cur, A[i]);
        for(j = 0; j < k; ++j) {
            A[i] *= x;
        }
        Add(&cur, A[i]);
        Get(&cur, &tempSum);
        if(tempSum > originSum) {
            originSum = tempSum;
        }
    }
    printf("%I64d\n", originSum);
    return 0;
}
// 1500439527677


#include "cstdio"
#include "iostream"
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
int n,k,x,a[200010];
int main(int argc, char const *argv[])
{
	cin >> n >> k >> x;
	rep(i,n){
		cin >> a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	long long ans = 0;
	int cnt = 0;
	for(int j=0; j<n; ++j){
		if(j && a[j]==a[j-1]) continue;
		cnt++;
		if(cnt > 500) break;
		long long r = a[j];
		rep(kk,k) r *= x;
		rep(i,n) if(i!=j) r |= a[i];
		ans = max(ans, r);
	}
	cout << ans;
	return 0;
}


#include "cstdio"
#include "iostream"
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
int n,k,x,a[200010];
int b[63];
long long ans = 0;
void up(long long x, int o){
    for(int i=0; x; x>>=1, ++i) if(x&1) b[i] += o;
    long long r = 0;
    rep(i,63) if(b[i]) r += 1ll<<i;
    ans = max(ans, r);
}
int main(int argc, char const *argv[])
{
	cin >> n >> k >> x;
	rep(i,n){
		cin >> a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	n = unique(a, a + n) - a;
    rep(i,n) up(a[i], 1);
	for(int j=0; j<n; ++j){
        long long r = a[j];
        rep(kk,k) r *= x;
        up(a[j], -1);
        up(r, 1);
        up(r, -1);
        up(a[j], 1);
	}
	cout << ans;
	return 0;
}


#include "cstdio"
#include "iostream"
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
int n,k,x,a[200010];
int main(int argc, char const *argv[])
{
	cin >> n >> k >> x;
	rep(i,n){
		cin >> a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	long long ans = 0;
	int cnt = 0;
	for(int j=0; j<n; ++j){
		if(j && a[j]==a[j-1]) continue;
		cnt++;
		if(cnt > 200) break;
		long long r = a[j];
		rep(kk,k) r *= x;
		rep(i,n) if(i!=j) r |= a[i];
		ans = max(ans, r);
	}
	cout << ans;
	return 0;
}


#include "cstdio"
#include "iostream"
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
int n,k,x,a[200010];
int b[63];
long long ans = 0;
void up(long long x, int o){
    for(int i=0; x; x>>=1, ++i) if(x&1) b[i] += o;
    long long r = 0;
    rep(i,63) if(b[i]) r += 1ll<<i;
    ans = max(ans, r);
}
int main(int argc, char const *argv[])
{
	cin >> n >> k >> x;
	rep(i,n){
		cin >> a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	//n = unique(a, a + n) - a;
    rep(i,n) up(a[i], 1);
	for(int j=0; j<n; ++j){
        long long r = a[j];
        rep(kk,k) r *= x;
        up(a[j], -1);
        up(r, 1);
        up(r, -1);
        up(a[j], 1);
	}
	cout << ans;
	return 0;
}


#include "cstdio"
#include "iostream"
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
int n,k,x,a[200010];
int main(int argc, char const *argv[])
{
	cin >> n >> k >> x;
	rep(i,n){
		cin >> a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	long long ans = 0;
	for(int j=0; j<min(100,n); ++j){
		long long r = a[j];
		rep(kk,k) r *= x;
		rep(i,n) if(i!=j) r |= a[i];
		ans = max(ans, r);
	}
	cout << ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[2*100010];
long long dp2[2*100020];

int main()
{
   // freopen("in","r",stdin);
long long n,x,k,ans,i;
long long a[200050];
cin>>n>>k>>x;
x=pow(x*1.,k*1.);
for(i=0;i<n;i++)
    cin>>a[i];
dp[0]=dp[n-1]=0;
for(i=1;i<n;i++)
    dp[i]=dp[i-1]|a[i-1];
for(i=n-2;i>=0;i--)
    dp[i]=dp[i+1]|a[i+1];
ans=0;
for(i=0;i<n;i++)
    ans=max(ans,x*a[i]|dp[i]|dp2[i]);
cout<<ans<<endl;
return 0;
}


#include<bits/stdc++.h>
using  namespace std;
long long nb[300000];
bool cmp(long long &a,long long &b)
{
    int z=(int)log(a*1.)/log(2.),z1=(int)log(a*1.)/log(2.);
    if(z!=z1)
        return z<z1;
    return a<b;

}
bool p2[40];
int kk;
int checkbit(long long n)
{
    int i,num=0;
for(i=0;i<kk;i++)
{
    if(n&&(1<<i))
        num++;

}
    return num;
}
int main()
{
    //freopen("in","r",stdin);
    long long n,i,j,k,x,xx,pos,res,ans,maxn;
    cin>>n>>k>>xx;
    memset(p2,true,sizeof p2);
    maxn=0;
    for(i=0;i<n;i++)

    {
        cin>>x;
        if(x>maxn)
            maxn=x;
     nb[i]=x;
    }
    sort(nb,nb+n,cmp);
    reverse(nb,nb+n);
    int mp=log(maxn*1.0)/log(2.);
     kk=log(maxn*xx*1.0)/log(2.);
    res=1000000000;
    pos=0;
    for(i=0;i<n;i++)
    {

        {  if(nb[i]<(1<<mp))
            break;
        int z=(checkbit(nb[i]*xx));
        if((z<res)||(res==z&&nb[pos]>nb[i]))
        {
            res=z;

            pos=i;
        }

         }

    }
    nb[pos]*=pow(xx,k);
    ans=0;
    for(i=0;i<n;i++)
        ans|=nb[i];
    cout<<ans<<endl;

}


#include<bits/stdc++.h>
using namespace std;
long dp[2*100010];
long dp2[2*100020];

int main()
{
    //freopen("in","r",stdin);
long n,x,k,ans,i;
long a[200050];
cin>>n>>k>>x;
x=pow(x*1.,k*1.);
for(i=0;i<n;i++)
    cin>>a[i];
dp[0]=dp[n-1]=0;
for(i=1;i<n;i++)
    dp[i]=dp[i-1]|a[i-1];
for(i=n-2;i>=0;i--)
    dp[i]=dp[i+1]|a[i+1];
ans=0;
for(i=0;i<n;i++)
    ans=max(ans,x*a[i]|dp[i]|dp2[i]);
cout<<ans<<endl;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[2*100010];
long long dp2[2*100020];

int main()
{
   // freopen("in","r",stdin);
long long n,x,k,ans,i;
long long a[200050];
cin>>n>>k>>x;
x=pow(x*1.+0.00000000001,k*1.);
for(i=0;i<n;i++)
    cin>>a[i];
dp[0]=dp[n-1]=0;
for(i=1;i<n;i++)
    dp[i]=dp[i-1]|a[i-1];
for(i=n-2;i>=0;i--)
    dp[i]=dp[i+1]|a[i+1];
ans=0;
for(i=0;i<n;i++)
    ans=max(ans,x*a[i]|dp[i]|dp2[i]);
cout<<ans<<endl;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
long dp[2*100010];
long dp2[2*100020];

int main()
{
   //
 freopen("in","r",stdin);
long n,x,k,ans,i;
long a[200050];
cin>>n>>k>>x;
x=pow(x*1.,k*1.);
for(i=0;i<n;i++)
    cin>>a[i];
dp[0]=dp[n-1]=0;
for(i=1;i<n;i++)
    dp[i]=dp[i-1]|a[i-1];
for(i=n-2;i>=0;i--)
    dp[i]=dp[i+1]|a[i+1];
ans=0;
for(i=0;i<n;i++)
    ans=max(ans,x*a[i]|dp[i]|dp2[i]);
cout<<ans<<endl;
return 0;
}


#include<bits/stdc++.h>
using  namespace std;
long long nb[300000];
bool cmp(long long &a,long long &b)
{
    int z=(int)log(a*1.)/log(2.),z1=(int)log(a*1.)/log(2.);
    if(z!=z1)
        return z<z1;
    return a<b;

}
bool p2[40];
int kk;
int checkbit(long long n)
{
    int i,num=0;
for(i=0;i<kk;i++)
{
    if(n&&(1<<i))
        num++;

}
    return num;
}
int main()
{
    //freopen("in","r",stdin);
    long long n,i,j,k,x,xx,pos,res,ans,maxn;
    cin>>n>>k>>xx;
    memset(p2,true,sizeof p2);
    maxn=0;
    for(i=0;i<n;i++)

    {
        cin>>x;
        if(x>maxn)
            maxn=x;
     nb[i]=x;
    }
    sort(nb,nb+n,cmp);
    reverse(nb,nb+n);
    int mp=log(maxn*1.0+0.000000001)/log(2.);
     kk=log(maxn*xx*1.0+0.0000000001)/log(2.);
    res=1000000000;
    pos=0;
    for(i=0;i<n;i++)
    {

        {  if(nb[i]<(1<<mp))
            break;
        int z=(checkbit(nb[i]*xx));
        if((z<res)||(res==z&&nb[pos]>nb[i]))
        {
            res=z;

            pos=i;
        }

         }

    }
    nb[pos]*=pow(xx,k);
    ans=0;
    for(i=0;i<n;i++)
        ans|=nb[i];
    cout<<ans<<endl;

}


/***********************************************
 * Author: fisty
 * Created Time: 2015-10-12 20:18:50
 * File Name   : D.cpp
 *********************************************** */
#include <iostream>
#include <cstring>
#include <deque>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <algorithm>
using namespace std;
#define Debug(x) cout << #x << " " << x <<endl
#define Memset(x, a) memset(x, a, sizeof(x))
const int INF = 0x3f3f3f3f;
typedef long long LL;
typedef pair<int, int> P;
#define FOR(i, a, b) for(int i = a;i < b; i++)
#define lson l, m, k<<1
#define rson m+1, r, k<<1|1
#define MAX_N 200000
int n, k, x;
LL a[MAX_N];

int main() {
    //freopen("in.cpp", "r", stdin);
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    scanf("%d%d%d", &n, &k, &x);
    for(int i = 0;i < n; i++){
        scanf("%I64d", &a[i]);
    }
    sort(a, a + n);
    LL _max = a[n-1];
    a[n-1] = a[n-1] * (LL)pow((double)x, (double)k);
    LL ans = 0;
    for(int i = 0;i < n; i++){
        ans |= a[i];
    }
    printf("%I64d\n", ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main()
{
	ll n;
	cin>>n;
	ll a[n][n],k;
	for(ll i=0;i<n;i++) for(ll j=0;j<n;j++)  cin>>a[i][j];
	k=(a[0][1]*a[0][2])/a[1][2];
	k=(ll)sqrt(k);
	cout<<k<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/k<<" ";
	cout<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long int ll;

int main()
{
	ll n;
	cin>>n;
	ll a[n][n],k;
	for(ll i=0;i<n;i++) for(ll j=0;j<n;j++)  cin>>a[i][j];
	k=(a[0][1]*a[0][2])/a[1][2];
	k=sqrt(k);
	cout<<k<<" ";
	for(ll i=1;i<n;i++) cout<<a[0][i]/k<<" ";
	cout<<endl;
}


#include <bits/stdc++.h>

using namespace std;

int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//

    int n;
    cin>> n;
    vector<int> a(n);
    for(int i =0;i < n;i++){
        int k  = 0;
        int q;
        for(int j = 0;j < n;j++){
            int t;
            cin>> t;
            if(i != j){
                if(k == 0){
                    q = t;
                    k++;
                }
                else{
                    q = gcd(q,t);
                }
            }
        }
        a[i] = q;
    }
    for(int t : a){
        cout << t << ' ';
    }

}


#include <bits/stdc++.h>

using namespace std;

#define int long long
int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//

    int n;
    cin>> n;
    vector<int> a(n);
    vector<vector<int>> v(n,vector<int>(n));
    for(int i =0;i < n;i++){
        int k  = 0;
        int q;
        for(int j = 0;j < n;j++){
            int t;
            cin>> t;
            if(i != j){
                if(k == 0){
                    q = t;
                    k++;
                }
                else{
                    q = gcd(q,t);
                }
            }
            v[i][j] = t;
        }
        a[i] = q;
    }

    for(int i =0;i<n;i++){
        for(int j =0 ;j <n;j++){
            if(i != j){
                if(a[i] * a[j] != v[i][j]){
                    while(a[i] * a[j] < v[i][j]){
                        continue;
                    }
                    if(a[i] * a[j] != v[i][j]){
                        int t = a[i] * a[j] / v[i][j];
                        if(a[i] % t == 0) a[i] /= t;
                        else a[j] /=t;
                    }
                }

            }
        }
    }
    for(int t : a){
        cout << t << ' ';
    }

}


#include <bits/stdc++.h>

using namespace std;

int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//

    int n;
    cin>> n;
    vector<int> a(n);
    vector<vector<int>> v(n,vector<int>(n));
    for(int i =0;i < n;i++){
        int k  = 0;
        int q;
        for(int j = 0;j < n;j++){
            int t;
            cin>> t;
            if(i != j){
                if(k == 0){
                    q = t;
                    k++;
                }
                else{
                    q = gcd(q,t);
                }
            }
            v[i][j] = t;
        }
        a[i] = q;
    }
    for(int i =0;i <n;i++){
        for(int j = 0;j <n ;j++){
            if(i != j){
                if(a[i] * a[j] != v[i][j]){
                    int t = a[j] * a[i] / v[i][j];
                    if(a[i] % t == 0) a[i] /=t;
                    else a[j] /= t;
                }
            }
        }
    }
    for(int t : a){
        cout << t << ' ';
    }

}


#include <bits/stdc++.h>

using namespace std;

//#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//
    int n;
    cin>> n;
    vector<int> a(n);
    vector<vector<int>> v(n,vector<int>(n));
    for(int i = 0;i < n;i++){
        for(int j = 0; j < n;j++){
            cin>> v[i][j];
        }
    }
    a[0] = sqrt(1ll* v[0][1] * v[0][2] / v[1][2]);
    for(int i =1;i < n;i++){
        a[i] = v[0][i] / a[0];
    }
    for(int v : a){
        cout << v << " ";
    }

}


#include <bits/stdc++.h>

using namespace std;

#define int long long
int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//

    int n;
    cin>> n;
    vector<int> a(n);
    vector<vector<int>> v(n,vector<int>(n));
    for(int i =0;i < n;i++){
        int k  = 0;
        int q;
        for(int j = 0;j < n;j++){
            int t;
            cin>> t;
            if(i != j){
                if(k == 0){
                    q = t;
                    k++;
                }
                else{
                    q = gcd(q,t);
                }
            }
            v[i][j] = t;
        }
        a[i] = q;
    }

    for(int i =0;i<n;i++){
        for(int j =0 ;j <n;j++){
            if(i != j){
                if(a[i] * a[j] != v[i][j]){
                    if(v[i][j] % a[j] == 0) a[i] = v[i][j]/a[i];
                    else a[j] = v[i][j]/a[i];
                }

            }
        }
    }
    for(int t : a){
        cout << t << ' ';
    }

}


#include <bits/stdc++.h>

using namespace std;

#define int long long
int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//

    int n;
    cin>> n;
    vector<int> a(n);
    vector<vector<int>> v(n,vector<int>(n));
    for(int i =0;i < n;i++){
        int k  = 0;
        int q;
        for(int j = 0;j < n;j++){
            int t;
            cin>> t;
            if(i != j){
                if(k == 0){
                    q = t;
                    k++;
                }
                else{
                    q = gcd(q,t);
                }
            }
            v[i][j] = t;
        }
        a[i] = q;
    }

    for(int i =0;i<n;i++){
        for(int j =0 ;j <n;j++){
            if(i != j){
                if(a[i] * a[j] != v[i][j]){
                    int t = a[i] * a[j] / v[i][j];
                    if(a[i] % t == 0) a[i] /= t;
                    else a[j] /=t;
                }
            }
        }
    }
    for(int t : a){
        cout << t << ' ';
    }

}


#include <bits/stdc++.h>

using namespace std;

#define int long long
int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//

    int n;
    cin>> n;
    vector<int> a(n);
    vector<vector<int>> v(n,vector<int>(n));
    for(int i =0;i < n;i++){
        int k  = 0;
        int q;
        for(int j = 0;j < n;j++){
            int t;
            cin>> t;
            if(i != j){
                if(k == 0){
                    q = t;
                    k++;
                }
                else{
                    q = gcd(q,t);
                }
            }
            v[i][j] = t;
        }
        a[i] = q;
    }

    for(int i =0;i<n;i++){
        for(int j =0 ;j <n;j++){
            if(i != j){
                if(a[i] * a[j] != v[i][j]){
                    if(v[i][j] % a[j] == 0) a[i] = v[i][j]/a[j];
                    else a[j] = v[i][j]/a[i];
                }

            }
        }
    }
    for(int t : a){
        cout << t << ' ';
    }

}


#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //------<<<<>>>>-----//
    int n;
    cin>> n;
    vector<int> a(n);
    vector<vector<int>> v(n,vector<int>(n));
    for(int i = 0;i < n;i++){
        for(int j = 0; j < n;j++){
            cin>> v[i][j];
        }
    }
    a[0] = sqrt(v[0][1] * v[0][2] / v[1][2]);
    for(int i =1;i < n;i++){
        a[i] = v[0][i] / a[0];
    }
    for(int v : a){
        cout << v << " ";
    }

}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
		mark[i] = num[i][1];
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			if(num[i][j]==0){
				continue;
			}
			mark[i] = __gcd(mark[i],num[i][j]);
		}
	}

//	for(int i = 1; i <= n; i++) {
//		for(int j = 2; j<=n; j++) {
//			mark[i] = min(mark[i],num[i][j]/mark[i]);
//		}
//	}puts("!!");
	for(int i = 1;i<=n;i++){
		mark [i] = 0;
		for(int j = 1;j<=n;j++){
//			cout<<num[i][j]/mark[j]<<endl;
			if(num[i][j] == 0){
				continue;
			}
			mark[i] = max(mark[i],num[i][j]/mark[j]);
		}
	}
	for(int i = 1;i<=n;i++){
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
		mark[i] = num[i][1];
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 2; j<=n; j++) {
			if(num[i][j]==0){
				continue;
			}
			mark[i] = __gcd(mark[i],num[i][j]);
		}
	}

//	for(int i = 1; i <= n; i++) {
//		for(int j = 2; j<=n; j++) {
//			mark[i] = min(mark[i],num[i][j]/mark[i]);
//		}
//	}puts("!!");
	for(int i = 1;i<=n;i++){
		mark [i] = 0;
		for(int j = 2;j<=n;j++){
//			cout<<num[i][j]/mark[j]<<endl;
			if(num[i][j] == 0){
				continue;
			}

			mark[i] = max(mark[i],num[i][j]/mark[j]);
		}
	}
	for(int i = 1;i<=n;i++){
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
		mark[i] = num[i][1];
	}
	temp = __gcd(num[1][2],num[2][3]);
	mark[1] = num[1][2] / temp;
	cout<<mark[1]<<" ";
	for(int i = 2;i<=n;i++){
		mark[i] = num[i][i-1]/mark[i-1];
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
		mark[i] = num[i][1];
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 2; j<=n; j++) {
			if(num[i][j]==0){
				continue;
			}
			mark[i] = __gcd(mark[i],num[i][j]);
		}
	}

//	for(int i = 1; i <= n; i++) {
//		for(int j = 2; j<=n; j++) {
//			mark[i] = min(mark[i],num[i][j]/mark[i]);
//		}
//	}puts("!!");
	for(int i = 1;i<=n;i++){
		for(int j = 2;j<=n;j++){
//			cout<<num[i][j]/mark[j]<<endl;
			if(num[i][j] == 0){
				continue;
			}
			mark[i] = min(mark[i],num[i][j]/mark[j]);
		}
	}
	for(int i = 1;i<=n;i++){
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99980000);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
	}
	mark[1] = sqrt((num[1][2]*num[1][3])/num[2][3]);
	cout<<mark[1]<<" ";
	for(int i = 2;i<=n;i++){
		mark[i] = num[i][i-1]/mark[i-1];
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
		mark[i] = num[i][1];
	}
	temp = __gcd(num[1][2],num[1][3]);
	mark[1] = num[1][2] / temp;
	cout<<mark[1]<<" ";
	for(int i = 2;i<=n;i++){
		mark[i] = num[i-1][i]/mark[i-1];
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
		mark[i] = num[i][1];
	}
	temp = __gcd(num[1][2],num[2][3]);
	mark[1] = num[1][2] / temp;
	cout<<mark[1]<<" ";
	for(int i = 2;i<=n;i++){
		mark[i] = num[i-1][i]/mark[i-1];
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
	}
	temp = __gcd(num[1][2],num[2][3]);
	mark[1] = num[1][2] / temp;
	cout<<mark[1]<<" ";
	for(int i = 2;i<=n;i++){
		mark[i] = num[i][i-1]/mark[i-1];
		cout<<mark[i]<<" ";
	}
	puts("");
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define mem(a,num) memset(a,num,sizeof(a))
const int maxn = 1e3+5;

ll t,m,n,temp,ans,maxum;
ll num[maxn][maxn];
ll mark[maxn];
string str;
map<char,int> mp;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout<<__gcd(99990000,99970002);
	cin>>n;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j<=n; j++) {
			cin>>num[i][j];
		}
	}
	ans = __gcd(num[1][n],num[1][n-1]);
	mark[n] = ans;
	for(int i = n-1; i>1; i--) {
		mark[i] = (mark[i+1],num[1][i]);
	}
	mark[1] = num[1][2] / mark[2];
	for(int i = 1;i<=n;i++){
		cout<<mark[i]<<" ";
	}
	puts("");
}