C,D=map(int,input().split()) if 5*C<=2*D: X=7000*C elif C>3*D: X=4000*D else: X=2000*(3*C+17*D)/13 print(X)