import random import math def annealingoptimize(T=10000, cool=0.99982, step=1): dimension=2 vec=[C*0.7,D*0.7] newvec = vec[:] while T > 0.0001: i = random.randint(0, dimension-1) dir = random.random() dir = (dir - 0.5) * step if i==0: stock_c=C-0.75*(vec[0]+dir)-2/7*vec[1] stock_d=D-0.25*(vec[0]+dir)-5/7*vec[1] else: stock_c=C-0.75*vec[0]-2/7*(vec[1]+dir) stock_d=D-0.25*vec[0]-5/7*(vec[1]+dir) if stock_c<0 or stock_d<0: newvec[i] = vec[i] else: newvec[i] = vec[i] + dir newcost = costf(newvec) cost = costf(vec) p = pow(math.e, -abs(newcost - cost) / T) if(newcost > cost or random.random() < p): vec[i] = newvec[i] T = T * cool return vec def costf(vec): return (1000*vec[0]+2000*vec[1]) C,D=[int(i) for i in input().split()] ans=0 k_min=[] for i in range(5): kkk=annealingoptimize() cost=costf(kkk) ans=max(ans,cost) # print (kkk, cost) print(ans)