#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  vector<int> x(5);
  for (ll i = 0; i < 5; i++) {
    cin >> x[i];
  }
  int max = 0, ans = 0;
  for (ll i = 0; i < 5; i++) {
    if (max < 10 - x[i] % 10) {
      max = 10 - x[i] % 10;
    }
    x[i] /= 10;
    x[i]++;
    x[i] *= 10;
    ans += x[i];
  }
  cout << ans - max;
  return 0;
}
