#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  int x = 0, tmp = 10;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0) {
      sum += a[i];
    } else {
      sum += (a[i] / 10 + 1) * 10;
      x = a[i] % 10;
    }
    tmp = min(x, tmp);
  }
  if (tmp == 10) tmp = 0;
  cout << sum + tmp - 10 << endl;
  return 0;
}
