#include <bits/stdc++.h>
using namespace std;
int main() {
  int abcde[5];
  cin >> abcde[0];
  int min_idx = 0;
  int min_time = abcde[0] % 10;
  for (int i = 1; i < 5; i++) {
    cin >> abcde[i];
    if (abcde[i] % 10 < min_time) {
      min_idx = i;
      min_time = abcde[i] % 10;
    }
  }
  int time = 0;
  for (int i = 0; i < 5; i++) {
    if (i == min_idx)
      time += abcde[i];
    else {
      if (abcde[i] % 10 == 0)
        time += abcde[i];
      else
        time += (abcde[i] / 10 + 1) * 10;
    }
  }
  cout << time << endl;
  return 0;
}
