#include <bits/stdc++.h>
using namespace std;
int main() {
  double a[5];
  int ans = 0;
  int Min = 10000000;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    ans += ceil(a[i] / 10) * 10;
    if (ceil(a[i] / 10) * 10 - a[i] == 0) continue;
    Min = min(Min, int(a[i] - (ceil(a[i] / 10) * 10) - 10));
  }
  cout << ans + Min + 10 << endl;
  return 0;
}
