#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> s(5);
  s = {a, b, c, d, e};
  int n = 19;
  int t = 8;
  for (int i = 0; i < 5; i++) {
    if (s[i] % 10 <= n % 10 && s[i] != 0) {
      n = s[i];
      t = i;
    }
  }
  int total = 0;
  for (int i = 0; i < 5; i++) {
    if (i != t) {
      if (s[i] % 10 != 0) s[i] = (s[i] / 10 + 1) * 10;
      total += s[i];
    } else {
      total += s[t];
    }
  }
  cout << total << endl;
}
