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