#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
long long ans = 0;
int main() {
  int a[5];
  int mn = 10;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    mn = min(a[i] % 10, mn);
    if (a[i] % 10 > 0) a[i] = 10 * (a[i] / 10 + 1);
    ans += a[i];
  }
  cout << ans - (10 - mn) << endl;
}
