C, D = map(int, input().split()) if 5*C-2*D<=0: print(7000*C) elif 3*D-C<=0: print(4000*D) else: print((6000*C+34000*D)/13)