local ffi = require 'ffi' local C = ffi.C ffi.cdef [[ long atol(const char *); int printf(const char *, ...); ]] C.printf("%ld\n", (function (f, s) return f(s) end)(function (s) local a,c,r,p = C.atol(s:match("(%d+)%s")),C.atol(s:match("%s(%d+)")),0LL,1LL while a~=0LL and c~=0LL do r,p,a,c = r+p*(a%2LL~=c%2LL and 1LL or 0LL),p*2LL,a/2LL,c/2LL end while a~=0LL do r,p,a = r+p*(a%2LL),p*2LL,a/2LL end while c~=0LL do r,p,c = r+p*(c%2LL),p*2LL,c/2LL end return r end, io.stdin:read("*l")))