using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ double l = 0; double r = C; Func f = x =>{ double ca = x; double da = x/3.0; if(da > D){ da = D; ca = 3.0*da; } double drest = D - da; double cb = C - ca; double db = cb /2.0*5.0; if(db > drest){ db = drest; cb = db /5.0 * 2.0; } return 1000*(ca+da)+2000*(cb+db); }; for(int t=200;t>=0;t--){ if(f((2*l + r)/3) > f((l+2*r)/3)){ r = (l+2*r)/3; }else{ l = (2*l+r)/3; } } double ret = f((l+r)/2); Console.WriteLine(ret); } double C,D; public Sol(){ var d = rda(); C = d[0]; D = d[1]; } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }