#include <bits/stdc++.h>
using namespace std;
int main() {
  int Time[5], last[5];
  int Total = 0, P = 0;
  for (int i = 0; i < 5; i++) {
    cin >> Time[i];
    last[i] = Time[i] % 10;
  }
  for (int i = 0; i < 5; i++) {
    if (Time[i] % 10 == 0) {
    } else {
      Time[i] = Time[i] / 10 * 10 + 10;
    }
  }
  for (int i = 0; i < 5; i++) {
    Total = Total + Time[i];
  }
  sort(last, last + 5);
  int K = 0;
  while (last[K] == 0) {
    K = K + 1;
  }
  P = last[K];
  Total = Total - 10 + P;
  cout << Total << endl;
}
