#include <iostream>
using namespace std;
int main() {
int x,y;
cin>>x>>y;
cout<<x*5-4+60*(y-1970);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgeCx5OwoJY2luPj54Pj55OwoJY291dDw8eCo1LTQrNjAqKHktMTk3MCk7CglyZXR1cm4gMDsKfQ==