let [| d1; d2 |] = stdin.ReadLine().Split() |> Array.map int if d1 > d2 then 0 elif d1 * 2 < d2 then 0 elif d1 = d2 then 4 elif d1 * 2 = d2 then 4 else 8 |> printfn "%d"