#include <iostream>
using namespace std;

int main() {
	int x,y;
	cin>>x>>y;
	cout<<x*5-4+60*(y-1970);
	return 0;
}