x, y = gets.chomp.split(" ").map(&:to_i)



count = 0
moveX = [2, 1]
moveY = [1, 2]

loop do 
    if(x > y)
        x -= moveX[0]
        y -= moveX[1]
    else(x < y)
        x -= moveY[0]
        y -= moveY[1]
    end
    count += 1
    if(x < 0 || y < 0)
        break
    end
end

kai = 1

for i in 1..count do
    kai = kai * i
end

puts kai