#include
using namespace std;
int main() {
int niza[5];
for(int i = 0; i < 5; i++) {
cin >> niza[i];
}
int sprat;
cin >> sprat;
int zbir = 0;
for(int i = 0; i < sprat - 1; i++) {
zbir += niza[i];
}
if(zbir == 0) {
cout << 100 << endl;
}
else if(zbir >= 1 and zbir <= 5) {
cout << 100 - 20 << endl;
}
else if(zbir >= 6 && zbir <= 20) {
cout << 100 - 40 << endl;
}
else {
cout << 100 - 50 << endl;
}
return 0;
}