#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int time[5], spoil[5], lack[5];
  int baisuu = 10;
  for (int i = 0; i < 5; i++) {
    cin >> time[i];
  }
  for (int i = 0; i < 5; i++) {
    spoil[i] = time[i] % baisuu;
  }
  int max = spoil[0];
  int num = 0;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    if (max > spoil[i]) {
      max = spoil[i];
      num = i;
    }
    lack[i] = 10 - spoil[i];
    sum += (time[i] + lack[i]);
  }
  sum -= lack[num];
  cout << sum << '\n';
  return 0;
}
