#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  int N = 5;
  cin >> a >> b >> c >> d >> e;
  vector<int> Time = {a, b, c, d, e};
  vector<int> nextTime(N);
  for (int i = 0; i < N; i++) {
    if (Time.at(i) % 10 == 0)
      nextTime.at(i) = Time.at(i);
    else
      nextTime.at(i) = Time.at(i) - Time.at(i) % 10 + 10;
  }
  int BastTime = 999999;
  for (int i = 0; i < N; i++) {
    int SumTime = 0;
    for (int j = 0; j < N; j++) {
      if (i == j) {
        SumTime += Time.at(i);
      } else {
        SumTime += nextTime.at(i);
      }
      BastTime = min(BastTime, SumTime);
    }
  }
  cout << BastTime << endl;
}
