#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  long long a[5];
  long long arg = -1;
  long long onesMin = 9;
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    long long onesPlace = a[i] % 10;
    if (onesPlace == 0 || onesMin <= onesPlace) continue;
    onesMin = onesPlace;
    arg = i;
  }
  long long ans = 0;
  for (long long i = 0; i < 5; i++) {
    if (i == arg) continue;
    long long onesPlace = a[i] % 10;
    if (onesPlace == 0) onesPlace = 10;
    ans += a[i] + (10 - onesPlace);
  }
  ans += a[arg];
  cout << ans << endl;
  ;
}
