#include <bits/stdc++.h>
int64_t inf = 1000000007;
int64_t giant = 4000000000000000037;
using namespace std;
void input() {}
int64_t cup(int64_t xxx38, int64_t yyy38) {
  return (xxx38 + yyy38 - 1) / yyy38;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  input();
  vector<int> dat(5);
  int sum = 0;
  int m = 10;
  for (int i = 0; i < 5; i++) {
    cin >> dat[i];
    sum += dat[i];
    int r = (dat[i] - 1) % 10;
    r++;
    r %= 10;
    m = min(m, r);
  }
  cout << sum - m << endl;
  return 0;
}
