#include <bits/stdc++.h>
int hanshu(int a[]) {
  int i = 0, j, m, n = 9;
  for (i = 0; i < 5; i++) {
    j = a[i];
    m = j % 10;
    if (m && m <= n) n = m;
    if (!m) n = 10;
  }
  return n;
}
int main() {
  int a[5], j, t, z, x, c, v, b;
  while (scanf("%d%d%d%d%d", &z, &x, &c, &v, &b) != EOF) {
    int m = 0;
    a[0] = z;
    a[1] = x;
    a[2] = c;
    a[3] = v;
    a[4] = b;
    t = hanshu(a);
    for (j = 0; j < 5; j++) {
      m = m + a[j] - a[j] % 10 + 10;
    }
    m = m + t - 10;
    printf("%d", m);
  }
  return 0;
}
