C,D=map(int,input().split()) MIN=0 MAX=min(C*4/3,D*4) def calc(x): C2=C-x*3/4 D2=D-x/4 y=min(C2*7/2,D2*7/5) return x*1000+y*2000 for i in range(1000): #print(MIN,MAX) mid1=MIN+(MAX-MIN)/3 mid2=MIN+(MAX-MIN)/3*2 if calc(mid1)>calc(mid2): MAX=mid2 else: MIN=mid1 print(calc((MAX+MIN)/2))