#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long a[5];
  long long sum = 0;
  long long k = 9;
  long long w = 1;
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0)
      sum += a[i];
    else
      sum += a[i] + (10 - (a[i] % 10));
    if (a[i] % 10 <= k && a[i] % 10 != 0) {
      k = a[i] % 10;
      w = i;
    }
  }
  cout << sum - (10 - k) << endl;
}
