#include <bits/stdc++.h>
using namespace std;
int Y[] = {0, 1, 0, -1, 1, 1, -1, -1};
void MN(long long int &a, long long int b) {
  if (a > b) a = b;
}
void MX(long long int &a, long long int b) {
  if (a < b) a = b;
}
void MN(int &a, int b) {
  if (a > b) a = b;
}
void MX(int &a, int b) {
  if (a < b) a = b;
}
void MN(double &a, int b) {
  if (a > b) a = b;
}
void MX(double &a, int b) {
  if (a < b) a = b;
}
long long int S, X, n, m;
bitset<41> Sum, Xor;
unsigned long long int dp[50][2][50][50];
void _(int sum, int r, int &b, int &nrem) {
  int nw = sum + r;
  if (nw == 3)
    b = nrem = 1;
  else if (nw == 2) {
    nrem = 1;
    b = 0;
  } else if (nw == 1) {
    b = 1;
    nrem = 0;
  } else
    b = nrem = 0;
}
unsigned long long int rec(int i, int rem, int f, int scanf) {
  if (i == n) {
    if (rem == 0 && f > 0 && scanf > 0)
      return 1;
    else
      return 0;
  }
  unsigned long long int &res = dp[i][rem][f][scanf];
  int b, nrem;
  if (res != -1)
    return res;
  else
    res = 0;
  if (!Xor[i]) {
    _(2, rem, b, nrem);
    if (b == Sum[i]) {
      res += rec(i + 1, nrem, f + 1, scanf + 1);
    }
    _(0, rem, b, nrem);
    if (b == Sum[i]) {
      res += rec(i + 1, nrem, f, scanf);
    }
  } else {
    _(1, rem, b, nrem);
    if (b == Sum[i]) {
      res += rec(i + 1, nrem, f + 1, scanf);
      res += rec(i + 1, nrem, f, scanf + 1);
    }
  }
  return res;
}
int main() {
  scanf("%lld%lld", &S, &X);
  memset(dp, -1, sizeof dp);
  Sum = S;
  Xor = X;
  for (int i = 0; i < 41; i++)
    if (Xor[i]) {
      m++;
      n = i;
    }
  for (int i = 0; i < 41; i++)
    if (Sum[i]) MX(n, i);
  n++;
  cout << rec(0, 0, 0, 0) << endl;
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

Two positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)?

Input

The first line of the input contains two integers s and x (2 ≤ s ≤ 1012, 0 ≤ x ≤ 1012), the sum and bitwise xor of the pair of positive integers, respectively.

Output

Print a single integer, the number of solutions to the given conditions. If no solutions exist, print 0.

Examples

Input

9 5


Output

4


Input

3 3


Output

2


Input

5 2


Output

0

Note

In the first sample, we have the following solutions: (2, 7), (3, 6), (6, 3), (7, 2).

In the second sample, the only solutions are (1, 2) and (2, 1).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int Y[] = {0, 1, 0, -1, 1, 1, -1, -1};
void MN(long long int &a, long long int b) {
  if (a > b) a = b;
}
void MX(long long int &a, long long int b) {
  if (a < b) a = b;
}
void MN(int &a, int b) {
  if (a > b) a = b;
}
void MX(int &a, int b) {
  if (a < b) a = b;
}
void MN(double &a, int b) {
  if (a > b) a = b;
}
void MX(double &a, int b) {
  if (a < b) a = b;
}
long long int S, X, n, m;
bitset<41> Sum, Xor;
unsigned long long int dp[50][2][50][50];
void _(int sum, int r, int &b, int &nrem) {
  int nw = sum + r;
  if (nw == 3)
    b = nrem = 1;
  else if (nw == 2) {
    nrem = 1;
    b = 0;
  } else if (nw == 1) {
    b = 1;
    nrem = 0;
  } else
    b = nrem = 0;
}
unsigned long long int rec(int i, int rem, int f, int scanf) {
  if (i == n) {
    if (rem == 0 && f > 0 && scanf > 0)
      return 1;
    else
      return 0;
  }
  unsigned long long int &res = dp[i][rem][f][scanf];
  int b, nrem;
  if (res != -1)
    return res;
  else
    res = 0;
  if (!Xor[i]) {
    _(2, rem, b, nrem);
    if (b == Sum[i]) {
      res += rec(i + 1, nrem, f + 1, scanf + 1);
    }
    _(0, rem, b, nrem);
    if (b == Sum[i]) {
      res += rec(i + 1, nrem, f, scanf);
    }
  } else {
    _(1, rem, b, nrem);
    if (b == Sum[i]) {
      res += rec(i + 1, nrem, f + 1, scanf);
      res += rec(i + 1, nrem, f, scanf + 1);
    }
  }
  return res;
}
int main() {
  scanf("%lld%lld", &S, &X);
  memset(dp, -1, sizeof dp);
  Sum = S;
  Xor = X;
  for (int i = 0; i < 41; i++)
    if (Xor[i]) {
      m++;
      n = i;
    }
  for (int i = 0; i < 41; i++)
    if (Sum[i]) MX(n, i);
  n++;
  cout << rec(0, 0, 0, 0) << endl;
  return 0;
}

```