#include <bits/stdc++.h>
using namespace std;
int last(int t) {
  if (t % 10 == 0)
    return 0;
  else
    return (10 - t % 10);
}
bool cmp(int x, int y) { return last(x) < last(y); }
int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  sort(a, a + 5, cmp);
  cout << (a[0] + (10 - a[0] % 10)) + (a[1] + (10 - a[1] % 10)) +
              (a[2] + (10 - a[2] % 10)) + (a[3] + (10 - a[3] % 10)) + (a[4])
       << endl;
}
