Codeforces Round 320 (Div. 2) [Bayan Thanks-Round]
D
"Or" Game
Codeforces
未评级
原题
← CE →
翻译中…

You are given $*n*$ numbers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. You can perform at most $*k*$ operations. For each operation you can multiply one of the numbers by $*x*$. We want to make image as large as possible, where image denotes the bitwise OR.

翻译中…

Find the maximum possible value of image after performing at most $*k*$ operations optimally.

翻译中…

Input

翻译中…

The first line contains three integers $*n*$, $*k*$ and $*x*$ ($1 ≤ *n* ≤ 200 000$, $1 ≤ *k* ≤ 10$, $2 ≤ *x* ≤ 8$).

翻译中…

The second line contains $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($0 ≤ *a*_{*i*} ≤ 10^{9}$).

翻译中…

Output

翻译中…

Output the maximum value of a bitwise OR of sequence elements after performing operations.

翻译中…

Note

翻译中…

For the first sample, any possible choice of doing one operation will result the same three numbers $1$, $1$, $2$ so the result is image.

翻译中…

For the second sample if we multiply $8$ by $3$ two times we'll get $72$. In this case the numbers will become $1$, $2$, $4$, $72$ so the OR value will be $79$ and is the largest possible result.

翻译中…

样例

Input #1
3 1 2
1 1 1
Output #1
3
InputCopy OutputCopy
Input #2
4 2 3
1 2 4 8
Output #2
79
InputCopy OutputCopy
题目信息
题号
579D
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。