#pragma warning disable using System.Collections.Generic; using System.IO; using System.Linq; using System; class E { static void Main() { new J(); } } class J { int F() { return int.Parse(Console.ReadLine()); } int[] G() { return Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray(); } public J() { Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); var I = G(); int C = I[0], D = I[1]; if (5 * C <= 2 * D) Console.WriteLine(7000 * C); else if (C > 3 * D) Console.WriteLine(4000 * D); else Console.WriteLine((6 * C + 34 * D) * 1000 / 13m); Console.Out.Flush(); } long GCD(long a, long b) { var n = (ulong)Math.Abs(a); var m = (ulong)Math.Abs(b); if (n == 0) return (long)m; if (m == 0) return (long)n; int zm = 0, zn = 0; while ((n & 1) == 0) { n >>= 1; zn++; } while ((m & 1) == 0) { m >>= 1; zm++; } while (m != n) { if (m > n) { m -= n; while ((m & 1) == 0) m >>= 1; } else { n -= m; while ((n & 1) == 0) n >>= 1; } } return (long)n << Math.Min(zm, zn); } }