#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int a = 10, d, ret = 0;
  for (int i=0; i<5; i++) {
    cin >> d;
    ret += ((d + 9) / 10) * 10;
    if (d % 10 > 0) a = min(a, d % 10);
  }
  cout << ret - (10 - a) << endl;
}