#include <bits/stdc++.h>
using namespace std;
int main() {
  int menu[5];
  for (int i = 0; i < 5; i++) cin >> menu[i];
  int minm = 9, sum = 0;
  for (int i = 0; i < 5; i++) {
    if (menu[i] % 10 != 0) {
      minm = min(minm, menu[i] % 10);
      menu[i] = ((menu[i] + 9) / 10) * 10;
    }
    sum += menu[i];
  }
  cout << sum - (10 - minm) << endl;
}
