A,B=gets.split.map &:to_f a,b=20*A-8*B,21*B-7*A p a<0 ? 7000*A : b<0 ? 4000*B : (1000*a+2000*b)/13