#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long> x(5);
  int res = 10;
  for (int i = 0; i < 5; i++) {
    cin >> x[i];
    if (x[i] % 10 != 0 && x[i] % 10 < res) {
      if (res < 10) x[0] += 10;
      res = x[i] % 10;
      x[i] -= res;
    } else if (x[i] % 10 != 0) {
      x[i] += (10 - x[i] % 10);
    }
  }
  for (int i = 0; i < 5; i++) res += x[i];
  cout << res << endl;
}
