#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e;
  int A = 0, B = 0, C = 0, D = 0, E = 0, ans = 0;
  scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
  ans =
      a - (a % 10) + b - (b % 10) + c - (c % 10) + d - (d % 10) + e - (e % 10);
  if ((a + b + c + d + e) % 10 != 0) {
    switch (a % 10 == 0) {
      case 0:
        A = a % 10;
        break;
      case 1:
        break;
    }
    switch (b % 10 == 0) {
      case 0:
        B = b % 10;
        break;
      case 1:
        break;
    }
    switch (c % 10 == 0) {
      case 0:
        C = c % 10;
        break;
      case 1:
        break;
    }
    switch (d % 10 == 0) {
      case 0:
        D = d % 10;
        break;
      case 1:
        break;
    }
    switch (e % 10 == 0) {
      case 0:
        E = e % 10;
        break;
      case 1:
        break;
    }
    if (A != 0 && A <= B && A <= C && A <= D && A <= E) {
      printf("%d", ans + A);
    } else if (B != 0 && B <= A && B <= C && B <= D && B <= E) {
      printf("%d", ans + B);
    } else if (C != 0 && C <= A && C <= B && C <= D && C <= E) {
      printf("%d", ans + C);
    } else if (D != 0 && D <= A && D <= B && D <= C && D <= E) {
      printf("%d", ans + D);
    } else if (E != 0 && E <= A && E <= B && E <= C && E <= D) {
      printf("%d", ans + E);
    }
  } else
    printf("%d", a + b + c + d + e);
  return 0;
}
