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