#include <bits/stdc++.h>
using namespace std;
int main() {
  int menu[5] = {};
  for (int i = 0; i < 5; i++) cin >> menu[i];
  int min1 = 10;
  int sum = 0;
  int point = 6;
  bool counter = true;
  for (int i = 0; i < 5; i++) {
    int one = menu[i] % 10;
    if (one != 0 && one <= min1) {
      if (counter) {
        min1 = one;
        point = i;
        counter = false;
        continue;
      }
      sum += menu[point] + (10 - (menu[point] % 10));
      ;
      min1 = one;
      point = i;
      continue;
    }
    if (one == 0) {
      sum += menu[i];
    } else {
      sum += menu[i] + (10 - (menu[i] % 10));
    }
  }
  sum += menu[point];
  cout << sum << endl;
}
