#include<iostream> using namespace std; int main() { long long x, n; cin >> x >> n; if (n <= 7) { cout << 250 * (n % 7) << endl; } else { cout << 250 * (5 * (n / 7) + n % 7); } return 0; }