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