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