require 'matrix'
x, y = gets.split.map(&:to_i)
mo = 10 ** 9 + 7
# a + 2b = x
# 2a + b = y
p = Matrix[
           [1, 2],
           [2, 1]]
q = Vector[x,
           y]
ans = p.inv*q
a = ans[0].denominator == 1 ? ans[0].to_i : 0
b = ans[1].denominator == 1 ? ans[1].to_i : 0
if a == 0 || b == 0
  puts 0
else
  c = 1
  a_calc = 1
  b_calc = 1
  if a >= b
    (a + b).downto(a + 1) do |v|
      c *= v
    end
    b.downto(2) do |v|
      b_calc *= v
    end
    answer = (c / b_calc) % mo
  else
    (a + b).downto(b + 1) do |v|
      c *= v
    end
    a.downto(2) do |v|
      a_calc *= v
    end
    answer = (c / a_calc) % mo
  end
  puts answer
end
