#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int a[5];
  int min_val = 9;
  int res = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) {
      min_val = min(min_val, a[i] % 10);
      res += (10 + a[i] - a[i] % 10);
    } else {
      res += a[i];
    }
  }
  res -= 10 - min_val;
  cout << res << endl;
  return 0;
}
