#include <bits/stdc++.h>
using namespace std;
int main() {
  int diff = 9;
  int total = 0;
  int menu;
  for (int i = 0; i < (int)(5); i++) {
    int d;
    cin >> d;
    if (d % 10 == 0)
      total += d;
    else {
      diff = min(diff, d % 10);
      d += 9;
      total += (d / 10) * 10;
    }
  }
  cout << total - (10 - diff) << endl;
  return 0;
}
