#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
int kiriage(int &number) {
  if (number % 10 == 0) return number;
  number++;
  return kiriage(number);
}
int main() {
  int sum = 0;
  int amari_min = 9;
  for (int i = 0; i < 5; i++) {
    int menu = 0;
    cin >> menu;
    int amari = menu % 10;
    if (amari != 0) {
      amari_min = min(amari_min, amari);
      kiriage(menu);
    }
    sum += menu;
  }
  cout << sum - (10 - amari_min) << endl;
  return 0;
}
