#include <bits/stdc++.h>
using namespace std;
long long gcd(long long m, long long n);
long long lcm(long long m, long long n);
int main(void) {
  vector<int> v;
  int ans = 0;
  int min = 2147483647;
  for (int i = 0; i < 5; i++) {
    int tmp;
    cin >> tmp;
    if (tmp < 10) {
      ans += 10;
      if (min > tmp) min = tmp;
      continue;
    }
    if (tmp % 10 == 0) {
      ans += tmp;
      continue;
    }
    int t = tmp - (tmp / 10) * 10;
    ans += tmp - t + 10;
    if (min > t) min = t;
  }
  ans = ans - 10 + min;
  cout << ans << endl;
  return 0;
}
long long gcd(long long m, long long n) {
  long long temp;
  while (m % n != 0) {
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}
long long lcm(long long m, long long n) { return m * n / gcd(m, n); }
