#include <bits/stdc++.h>
int main() {
  int x[5];
  int x2[5];
  int i, j;
  int min;
  for (i = 0; i < 5; i++) {
    scanf("%d", &x[i]);
  }
  for (j = 0; j < 5; j++) {
    x2[j] = x[j] % 10;
    if (x2[j] = 0) x2[j] = 10;
  }
  int temp;
  int n, m;
  for (n = 0; n < 4; n++) {
    for (m = 4; m > n; m--) {
      if (x2[m] < x2[m - 1]) temp = x[m];
      x[m] = x[m - 1];
      x[m - 1] = temp;
    }
  }
  int ans = 0;
  int p;
  for (p = 4; p > 0; p--) {
    if (x[p] % 10 != 0) x[p] = (x[p] / 10) + 10;
    ans += x[p];
  }
  ans = ans + x[0];
  printf("%d", ans);
}
