#include<bits/stdc++.h> int a,b,c,d,m; using namespace std; int main(){ cin>>a>>b>>c>>d>>m; cout<<c*5+d*20-(b-d)*20; return 0; }