#include <bits/stdc++.h>
using namespace std;
int rest(int a) {
  if (a % 10 != 0)
    return a % 10;
  else
    return 10;
}
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int time = 0;
  time += (a / 10 + 1) * 10;
  time += (b / 10 + 1) * 10;
  time += (c / 10 + 1) * 10;
  time += (d / 10 + 1) * 10;
  time += (e / 10 + 1) * 10;
  int last = 10;
  int additional = min({rest(a), rest(b), rest(c), rest(d), rest(e)});
  cout << time - (10 - additional) << endl;
}
