x_fin,y_fin = gets.chomp.split(" ").map(&:to_i)

if (x_fin + y_fin) % 3 != 0
  puts 0
  exit
end

x_plus_y =(x_fin + y_fin)/3
x_minus_y = x_fin - y_fin

x = (x_plus_y + x_minus_y)/2
y = (x_plus_y - x_minus_y)/2
  
product = 1
total_moving = x+y
(x..total_moving).each do |n|
  product *= n
end

puts product