output_description: Print the number of pairs of integers (x, y) (L \leq x \leq y \leq R)
  satisfying the condition, modulo 10^9 + 7.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      L R
attempt: # L, R = map(lambda x: bin(int(x))[2:], input().split())
  L_, R_ = map(lambda x: int(x), input().split())
  L, R = bin(L_)[2:], bin(R_)[2:]
  P = int(1e9 + 7)
  n_pattern = [0] * (len(R))
  n_pattern[0] = 1
  for i in range(1, len(R)):
      n_pattern[i] = (3 * n_pattern[i - 1]) % P
  
  ans = 0
  for i in range(len(R)):
      ans = (ans + n_pattern[i]) % P
  
  # xがL未満をひく
  for i in range(len(L) - 1):
      ans = (ans - n_pattern[i]) % P
  tmp = 1
  for i, l in enumerate(L):
      if i == 0:
          continue
      elif l == "0":
          tmp *= 2
      elif l == "1":
          ans = (ans - tmp * 2 * n_pattern[len(L) - i - 1]) % P
  
  # y がR以降を引く
  tmp = 1
  for i, r in enumerate(R):
      if i == 0:
          continue
      elif r == "1":
          tmp *= 2
      elif r == "0":
          ans = (ans - tmp * 2 * n_pattern[len(R) - i - 1]) % P
  print(ans)
  
  
  def solve_naive(L, R):
      cnt = 0
      keta = len(bin(R)[2:])
      for x in range(1, pow(2, keta)):
          for y in range(x, pow(2, keta)):
              cnt += (y % x) == (x ^ y)
      print(cnt)
      for x in range(1, L):
          for y in range(x, pow(2, keta)):
              cnt -= (y % x) == (x ^ y)
      print(cnt)
      for x in range(1, pow(2, keta)):
          for y in range(R + 1, pow(2, keta)):
              if x > y:
                  continue
              cnt -= (y % x) == (x ^ y)
      print(cnt)
  
  
  # solve_naive(L_, R_)
  
problem_description: Statement
  
  Given are integers L and R. Find the number, modulo 10^9 + 7, of pairs of
  integers (x, y) (L \leq x \leq y \leq R) such that the remainder when y is
  divided by x is equal to y \mbox{ XOR } x.
  
  What is \mbox{ XOR }?
  
  The XOR of integers A and B, A \mbox{ XOR } B, is defined as follows:
  
    * When A \mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.
  
  For example, 3 \mbox{ XOR } 5 = 6. (In base two: 011 \mbox{ XOR } 101 = 110.)
samples: [{"input": "2 3", "output": "3\n    \n\nThree pairs satisfy the condition: (2, 2), (2, 3), and (3, 3).\n\n* * *"}, {"input": "10 100", "output": "604\n    \n\n* * *"}, {"input": "1 1000000000000000000", "output": "68038601\n    \n\nBe sure to compute the number modulo 10^9 + 7."}]