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