a,b=map(int,input().split())

if a%2==0:
  if b%2==0:
    c=((b-1)//2-a//2+1)%2
    if c==0:
      print(b)
    else:
      if b%2==0:
        print(b+1)
      else:
        print(b-1)
  else:
    print((b//2-a//2+1)%2)
else:
  if b%2==0:
    c=(b//2-a//2-1)%2
    ans=list(format(b,"b")[::-1])
    ans[0]=str((int(ans[0])+c)%2)
    for i,x in enumerate(format(a,"b")[::-1]):
      ans[i]=str((int(ans[i])+int(x))%2)

    ans=str("0b"+"".join(ans[::-1]))
    print(int(ans,0))
    
  else:
    c=(b//2-(a+1)//2+1)%2
    if c==0:
      print(a)
    else:
      if a%2==0:
        print(a+1)
      else:
        print(a-1) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if a%2==0:
  if b%2==0:
    c=((b-1)//2-a//2+1)%2
    if c==0:
      print(b)
    else:
      if b%2==0:
        print(b+1)
      else:
        print(b-1)
  else:
    print((b//2-a//2+1)%2)
else:
  if b%2==0:
    c=(b//2-a//2-1)%2
    ans=list(format(b,"b")[::-1])
    ans[0]=str((int(ans[0])+c)%2)
    for i,x in enumerate(format(a,"b")[::-1]):
      ans[i]=str((int(ans[i])+int(x))%2)

    ans=str("0b"+"".join(ans[::-1]))
    print(int(ans,0))
    
  else:
    c=(b//2-(a+1)//2+1)%2
    if c==0:
      print(a)
    else:
      if a%2==0:
        print(a+1)
      else:
        print(a-1) a%2==0 a%2 a 2 0 if b%2==0:
    c=((b-1)//2-a//2+1)%2
    if c==0:
      print(b)
    else:
      if b%2==0:
        print(b+1)
      else:
        print(b-1)
  else:
    print((b//2-a//2+1)%2) b%2==0 b%2 b 2 0 c=((b-1)//2-a//2+1)%2 c ((b-1)//2-a//2+1)%2 (b-1)//2-a//2+1 (b-1)//2-a//2 (b-1)//2 b-1 b 1 2 a//2 a 2 1 2 if c==0:
      print(b)
    else:
      if b%2==0:
        print(b+1)
      else:
        print(b-1)
   c==0 c 0 print(b) print b if b%2==0:
        print(b+1)
      else:
        print(b-1)
   b%2==0 b%2 b 2 0 print(b+1) print b+1 b 1 print(b-1) print b-1 b 1 print((b//2-a//2+1)%2) print (b//2-a//2+1)%2 b//2-a//2+1 b//2-a//2 b//2 b 2 a//2 a 2 1 2 if b%2==0:
    c=(b//2-a//2-1)%2
    ans=list(format(b,"b")[::-1])
    ans[0]=str((int(ans[0])+c)%2)
    for i,x in enumerate(format(a,"b")[::-1]):
      ans[i]=str((int(ans[i])+int(x))%2)

    ans=str("0b"+"".join(ans[::-1]))
    print(int(ans,0))
    
  else:
    c=(b//2-(a+1)//2+1)%2
    if c==0:
      print(a)
    else:
      if a%2==0:
        print(a+1)
      else:
        print(a-1) b%2==0 b%2 b 2 0 c=(b//2-a//2-1)%2 c (b//2-a//2-1)%2 b//2-a//2-1 b//2-a//2 b//2 b 2 a//2 a 2 1 2 ans=list(format(b,"b")[::-1]) ans list(format(b,"b")[::-1]) list format(b,"b")[::-1] (b,"b") format b "b" ::-1 -1 ans[0]=str((int(ans[0])+c)%2) ans[0] ans 0 str((int(ans[0])+c)%2) str (int(ans[0])+c)%2 int(ans[0])+c int(ans[0]) int ans[0] ans 0 c 2 for i,x in enumerate(format(a,"b")[::-1]):
      ans[i]=str((int(ans[i])+int(x))%2)

     i x enumerate(format(a,"b")[::-1]) enumerate format(a,"b")[::-1] (a,"b") format a "b" ::-1 -1 ans[i]=str((int(ans[i])+int(x))%2) ans[i] ans i str((int(ans[i])+int(x))%2) str (int(ans[i])+int(x))%2 int(ans[i])+int(x) int(ans[i]) int ans[i] ans i int(x) int x 2 ans=str("0b"+"".join(ans[::-1])) ans str("0b"+"".join(ans[::-1])) str "0b"+"".join(ans[::-1]) "0b" "".join(ans[::-1]) "".join "" join ans[::-1] ans ::-1 -1 print(int(ans,0)) print int(ans,0) int ans 0 c=(b//2-(a+1)//2+1)%2 c (b//2-(a+1)//2+1)%2 b//2-(a+1)//2+1 b//2-(a+1)//2 b//2 b 2 (a+1)//2 a+1 a 1 2 1 2 if c==0:
      print(a)
    else:
      if a%2==0:
        print(a+1)
      else:
        print(a-1) c==0 c 0 print(a) print a if a%2==0:
        print(a+1)
      else:
        print(a-1) a%2==0 a%2 a 2 0 print(a+1) print a+1 a 1 print(a-1) print a-1 a 1 ans=str("0b"+"".join(ans[::-1])) str("0b"+"".join(ans[::-1])) ans a,b=map(int,input().split()) map(int,input().split()) a c=(b//2-a//2-1)%2 (b//2-a//2-1)%2 c c=((b-1)//2-a//2+1)%2 ((b-1)//2-a//2+1)%2 c b=map(int,input().split()) map(int,input().split()) b c=(b//2-(a+1)//2+1)%2 (b//2-(a+1)//2+1)%2 c ans=list(format(b,"b")[::-1]) list(format(b,"b")[::-1]) ans
a,b=map(int,input().split())

if a%2==0:
  if b%2==0:
    c=((b-1)//2-a//2+1)%2
    if c==0:
      print(b)
    else:
      if b%2==0:
        print(b+1)
      else:
        print(b-1)
  else:
    print((b//2-a//2+1)%2)
else:
  if b%2==0:
    c=(b//2-a//2-1)%2
    ans=list(format(b,"b")[::-1])
    ans[0]=str((int(ans[0])+c)%2)
    for i,x in enumerate(format(a,"b")[::-1]):
      ans[i]=str((int(ans[i])+int(x))%2)

    ans=str("0b"+"".join(ans[::-1]))
    print(int(ans,0))
    
  else:
    c=(b//2-(a+1)//2+1)%2
    if c==0:
      print(a)
    else:
      if a%2==0:
        print(a+1)
      else:
        print(a-1)