#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int sum = 0;
  int last = 99;
  int last_num = 0;
  for (int i = 0; i <= 4; i++) {
    if (a[i] % 10 < last && a[i] % 10 != 0) {
      last = a[i] % 10;
      last_num = i;
    }
  }
  for (int i = 0; i <= 4; i++) {
    sum += a[i];
    sum += (10 - a[i] % 10) % 10;
  }
  if (last == 99)
    cout << sum << endl;
  else
    cout << sum - last << endl;
}
