#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a, b, c, d, e;
  a = A % 10;
  if (A % 10 == 0) {
    a += 10;
  }
  b = B % 10;
  if (B % 10 == 0) {
    b += 10;
  }
  c = C % 10;
  if (C % 10 == 0) {
    c += 10;
  }
  d = D % 10;
  if (D % 10 == 0) {
    d += 10;
  }
  e = E % 10;
  if (E % 10 == 0) {
    e += 10;
  }
  int mi = min(a, min(b, min(c, min(d, e))));
  if (A % 10 == 0) {
    A -= 10;
  }
  if (B % 10 == 0) {
    B -= 10;
  }
  if (C % 10 == 0) {
    C -= 10;
  }
  if (D % 10 == 0) {
    D -= 10;
  }
  if (E % 10 == 0) {
    E -= 10;
  }
  if (mi == a) {
    cout << A + B + 10 - B % 10 + C + 10 - C % 10 + D + 10 - D % 10 + E + 10 -
                E % 10
         << endl;
    return 0;
  }
  if (mi == b) {
    cout << A + 10 - A % 10 + B + C + 10 - C % 10 + D + 10 - D % 10 + E + 10 -
                E % 10
         << endl;
    return 0;
  }
  if (mi == c) {
    cout << A + 10 - A % 10 + B + 10 - B % 10 + C + D + 10 - D % 10 + E + 10 -
                E % 10
         << endl;
    return 0;
  }
  if (mi == d) {
    cout << A + 10 - A % 10 + B + 10 - B % 10 + C + 10 - C % 10 + D + E + 10 -
                E % 10
         << endl;
    return 0;
  }
  if (mi == e) {
    cout << A + 10 - A % 10 + B + 10 - B % 10 + C + 10 - C % 10 + D + 10 -
                D % 10 + E
         << endl;
    return 0;
  }
}
