#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int time[5] = {0};
  for (int i = 0; i < 5; i++) cin >> time[i];
  int min_mod = 9;
  for (int i = 0; i < 5; i++)
    if (time[i] % 10 != 0) min_mod = min(time[i] % 10, min_mod);
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += (time[i] + 9) / 10 * 10;
  }
  cout << sum - 10 + min_mod << endl;
}
