#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> abc(5);
  for (int i = 0; i < 5; i++) {
    cin >> abc[i];
  }
  int ans = abc[0] + abc[1] + abc[2] + abc[3] + abc[4];
  sort(abc.begin(), abc.end());
  reverse(abc.begin(), abc.end());
  ans += 40 -
         (abc[0] % 10 + abc[1] % 10 + abc[2] % 10 + abc[3] % 10 + abc[4] % 10) +
         abc[0];
  cout << ans << endl;
}
