#include <bits/stdc++.h>
using namespace std;
int A[5], T, M;
int main(void) {
  M = INT_MAX;
  scanf("%d%d%d%d%d", &A[0], &A[1], &A[2], &A[3], &A[4]);
  for (int i = 0; i < 5; i++)
    if (A[i] % 10 != 0)
      T += A[i] + (10 - A[i] % 10);
    else
      T += A[i];
  for (int i = 0; i < 5; i++)
    if (A[i] % 10 != 0 && T - (10 - A[i] % 10) < M) M = T - (10 - A[i] % 10);
  printf("%d\n", M);
}
