#include <bits/stdc++.h>
using namespace std;
int main() {
  int s, m, a, t;
  for (int i = 1; i <= 5; i++) {
    cin >> a;
    t = (a - 1) / 10 * 10 + 10;
    s += t;
    if (m < t - a) m = t - a;
  }
  cout << s - m << endl;
  return 0;
}
