#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> vec;
  vec = {a, b, c, d, e};
  for (int i = 0; i < 5; i++) {
    vec.at(i) %= 10;
    vec.at(i) = 10 - vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int wait = 0;
  for (int i = 0; i < 4; i++) {
    wait += vec.at(i);
  }
  cout << a + b + c + d + e + wait << endl;
}
