#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int range[5], k[5];
  int n, sum = 0;
  for (int i = 0; i < 5; i++) {
    range[i] = 0;
  }
  for (int i = 0; i < 5; i++) {
    cin >> n;
    if ((n % 10) != 0) {
      range[i] = (10 - n % 10);
      sum = sum + n + (10 - n % 10);
    } else {
      sum += n;
    }
  }
  reverse(range, range + 4);
  sum += range[0];
  cout << sum << endl;
  return 0;
}
