#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[5];
  int reast_i = -1;
  int reast = 9;
  for (int i = (int)(0); i < (int)(5); i++) {
    cin >> A[i];
    if (A[i] % 10 != 0 && A[i] % 10 < reast) {
      reast = A[i] % 10;
      reast_i = i;
    }
  }
  int result = 0;
  for (int i = (int)(0); i < (int)(5); i++) {
    if (A[i] % 10 == 0 || reast_i == i)
      result += A[i];
    else
      result += A[i] + 10 - A[i] % 10;
  }
  cout << result << endl;
}
