#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
map<int, int> mm;
int gcd(int a, int b) {
  if (a < b) {
    int tmp = a;
    a = b;
    b = tmp;
  }
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main() {
  int ans = 0;
  vector<int> m;
  for (int i = 0; i < (5); i++) {
    int n;
    cin >> n;
    if (n % 10 == 0)
      ans += n;
    else {
      int a = (n / 10 + 1) * 10 - n;
      m.push_back(a);
      ans += (n / 10 + 1) * 10;
    }
  }
  sort(m.begin(), m.end());
  reverse(m.begin(), m.end());
  cout << ans - m[0] << endl;
  cin >> ans;
  return 0;
}
