#include <bits/stdc++.h>
int main(void) {
  int A, B, C, a, b, c, d, e, k, i, j, cou, min, v[1000000];
  char S[100000];
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  min = a % 10;
  if ((min > b % 10) && (b % 10 != 0)) {
    min = b % 10;
  }
  if ((min > c % 10) && (c % 10 != 0)) {
    min = c % 10;
  }
  if ((min > d % 10) && (d % 10 != 0)) {
    min = d % 10;
  }
  if ((min > e % 10) && (e % 10 != 0)) {
    min = e % 10;
  }
  if ((a % 10 != 0) && (a % 10 != min)) {
    a = a / 10 + 1;
    a = a * 10;
  }
  if ((b % 10 != 0) && (b % 10 != min)) {
    b = b / 10 + 1;
    b = b * 10;
  }
  if ((c % 10 != 0) && (c % 10 != min)) {
    c = c / 10 + 1;
    c = c * 10;
  }
  if ((d % 10 != 0) && (d % 10 != min)) {
    d = d / 10 + 1;
    d = d * 10;
  }
  if ((e % 10 != 0) && (e % 10 != min)) {
    e = e / 10 + 1;
    e = e * 10;
  }
  printf("%d", a + b + c + d + e);
  return 0;
}
