#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A[5];
  for (ll i = 0; i < 5; i++) {
    cin >> A[i];
  }
  int ans = 0;
  int tmp = 9;
  for (ll i = 0; i < 5; i++) {
    if (A[i] % 10) {
      if (tmp > A[i] % 10) {
        tmp = A[i] % 10;
      }
    }
  }
  for (ll i = 0; i < 5; i++) {
    if (A[i] % 10) {
      ans += ((A[i] / 10 + 1) * 10);
    } else {
      ans += A[i];
    }
  }
  cout << ans - 10 + tmp << endl;
  return 0;
}
