Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/bit-k-bitni-almashtirish

Flip the k-th bit

Easy 1000 ms 128 MB 20%
Share

Integers $n$ and $k$ are given. Flip the $k$-th bit in the binary representation of $n$ ($0$ becomes $1$, $1$ becomes $0$). Bits are numbered from right to left, starting from $0$. Find the resulting number. For example, for $n = 5 = 101_{2}$, $k = 1$ the result is $111_{2} = 7$.

Flipping one bit in the binary representation of a number

Input

One line with two integers: $n$ and $k$.

Output

One integer — the resulting number.

Note

$0 \le n \lt 2^{60}$
$0 \le k \le 60$

Examples

Input #1
5 1
Output #1
7
Input #2
8 3
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.