#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5];
  for (int i = 0; i < 5; i++) cin >> a[i];
  int time, round, max_diff;
  for (int i = 0; i < 5; i++) {
    round = a[i] / 10 + !!(a[i] % 10);
    round *= 10;
    max_diff = max(max_diff, round - a[i]);
    time += round;
  }
  cout << time - max_diff;
}
