#include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long N, K; cin >> N >> K; long long mod = 998244353; long long dp[65][65][2] = {}; dp[0][0][0] = 1; for(int i = 0; i <= 61; i++){ if(!((N >> i) & 1) && !((K >> i) & 1)){ for(int j = 0; j <= i+1; j++){ dp[i+1][j][0] += dp[i][j][0]; dp[i+1][j+1][0] += dp[i][j][1]; dp[i+1][j][0] %= mod; dp[i+1][j+1][0] %= mod; } }else if(!((N >> i) & 1) && ((K >> i) & 1)){ for(int j = 0; j <= i+1; j++){ dp[i+1][j+1][0] += dp[i][j][0]; dp[i+1][j][1] += dp[i][j][1]; dp[i+1][j+1][0] %= mod; dp[i+1][j][1] %= mod; } }else if(((N >> i) & 1) && !((K >> i) & 1)){ for(int j = 0; j <= i+1; j++){ dp[i+1][j][0] += dp[i][j][0]; dp[i+1][j+1][0] += dp[i][j][0]; dp[i+1][j+1][0] += dp[i][j][1]; dp[i+1][j][1] += dp[i][j][1]; dp[i+1][j][0] %= mod; dp[i+1][j+1][0] %= mod; dp[i+1][j][1] %= mod; } }else if(((N >> i) & 1) && ((K >> i) & 1)){ for(int j = 0; j <= i+1; j++){ dp[i+1][j+1][0] += dp[i][j][0]; dp[i+1][j][1] += dp[i][j][0]; dp[i+1][j][1] += dp[i][j][1]; dp[i+1][j+1][1] += dp[i][j][1]; dp[i+1][j+1][0] %= mod; dp[i+1][j+1][1] %= mod; dp[i+1][j][1] %= mod; } } } long long ans = 0; for(int i = 0; i <= 61; i++){ long long tmp1 = (1LL << i) % mod; long long tmp2 = dp[62][i][0]; ans += tmp1 * tmp2 % mod; } cout << ans % mod << "\n"; }