#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef vector vi; int C, D; double calc(double a) { double b = min((C-3*a/4)*7/2, (D-a/4)*7/5); if (b < 0) b = 0; return 1000*a + 2000*b; } int main() { cin >> C >> D; double low = 0, high = min(4.*C/3, 4.*D); for (int t = 0; t < 100; ++t) { const double m1 = (2*low+high)/3; const double m2 = (low+2*high)/3; if (calc(m1) < calc(m2)) low = m1; else high = m2; } printf("%.10lf\n", calc((low+high)/2)); return 0; }