#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int divCeil(int A, int B) { return (A + (B - 1)) / B; }
long long divCeil(long long A, int B) { return (A + (B - 1)) / B; }
long long divCeil(int A, long long B) { return (A + (B - 1)) / B; }
long long divCeil(long long A, long long B) { return (A + (B - 1)) / B; }
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a = A % 10;
  int b = B % 10;
  int c = C % 10;
  int d = D % 10;
  int e = E % 10;
  int ans1 = min(min(min(min(a, b), c), d), e);
  a = (A / 10 + 1) * 10;
  b = (B / 10 + 1) * 10;
  c = (C / 10 + 1) * 10;
  d = (D / 10 + 1) * 10;
  e = (E / 10 + 1) * 10;
  int ans0 = a + b + c + d + e - 10;
  cout << ans0 + ans1 << endl;
}
