#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int aux;
  for (int i = 0; i < 5; i++) {
    cin >> aux;
    v.push_back(aux);
  }
  int total = 0;
  int dif = -1;
  for (auto x : v) {
    if (x % 10 != 0) {
      if (10 - (x % 10) > dif) dif = 10 - (x % 10);
      total += 10 + (x - (x % 10));
    } else {
      total += x;
    }
  }
  total -= dif;
  cout << total << endl;
  return 0;
}
