#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[5];
  for (int i = 0; i < 5; i++) cin >> A[i];
  int resA[5];
  for (int i = 0; i < 5; i++) resA[i] = A[i] % 10;
  int minresindex = 0;
  int minresA = 10000000;
  for (int i = 0; i < 5; i++) {
    if (resA[i] < minresA && resA[i] != 0) {
      minresA = resA[i];
      minresindex = i;
    }
  }
  int totaltime = 0;
  for (int i = 0; i < 5; i++) {
    if (resA[i] == 0)
      totaltime += (A[i] / 10) * 10;
    else
      totaltime += (A[i] / 10 + 1) * 10;
  }
  totaltime = totaltime - (10 - minresA);
  cout << totaltime;
  return 0;
}
