#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int num = 11;
  int p = 0;
  if (num > A % 10) {
    num = A % 10;
    p = A;
  }
  if (num > B % 10) {
    num = B % 10;
    p = B;
  }
  if (num > C % 10) {
    num = C % 10;
    p = C;
  }
  if (num > D % 10) {
    num = D % 10;
    p = D;
  }
  if (num > E % 10) {
    num = E % 10;
    p = E;
  }
  cout << (A + 10 - A % 10) + (B + 10 - B % 10) + (C + 10 - C % 10) +
              (D + 10 - D % 10) + (E + 10 - E % 10) - (p + 10 - p % 10) + p
       << endl;
}
