local mmi, mma = math.min, math.max local mfl, mce = math.floor, math.ceil local c, d = io.read("*n", "*n") --[[ 3/2, 1/2 2/7, 5/7 2/7 + 17/14, 1/2 + 3/14 ]] local function solve(x) local crem = c - x * 2 / 7 local drem = d - x * 1 / 2 if crem < 0 or drem < 0 then return false end local z = crem / (17 / 14) + drem / (3 / 14) return x <= z end local min, max = 0, 1000000007 for irep = 1, 200 do local mid = (min + max) / 2 if solve(mid) then min = mid else max = mid end end print(min * 2000)