#include <bits/stdc++.h>
using namespace std;
int main() {
  array<int, 5> a;
  int time = 0;
  int zero_count = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0) {
      time += a[i];
      zero_count++;
    }
  }
  sort(a.begin(), a.end(), [](int x, int y) { return (x % 10) > (y % 10); });
  int cnt = 0;
  while (cnt != 5 - zero_count) {
    time += a[cnt];
    time += (10 - ((a[cnt++] % 10)));
  }
  time -= (10 - ((a[--cnt] % 10)));
  cout << time << "\n";
}
