#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll A, B; cin >> A >> B; auto f = [&](double v){ double C = A, D = B; C -= 3 * v / 4; D -= v / 4; if(C < 0 || D < 0) return -10000000000.0; double ans = 1000 * v; double d = min(7 * C / 2, 7 * D / 5); ans += 2000 * d; return ans; }; double l = 0, r = 100000, c1, c2, v1, v2; for(int i = 0; i < 128; i++){ c1 = (l * 2 + r) / 3; c2 = (l + 2 * r) / 3; v1 = f(c1), v2 = f(c2); if(v1 >= v2) r = c2; else l = c1; } cout << fixed << setprecision(15) << f(l) << '\n'; }