#include <bits/stdc++.h>
int main(void) {
  int x[5], time = 0, s = 10;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &x[i]);
  }
  for (int i = 0; i < 5; i++) {
    if (x[i] % 10 == 0) {
      time += x[i];
      x[i] = 0;
    } else {
      if (x[i] % 10 < s) {
        int temp = s;
        s = x[i];
        x[i] = temp;
      }
    }
    for (int i = 0; i < 5; i++) {
      if (x[i] != 0) {
        x[i] /= 10;
        x[i] += 1;
        x[i] *= 10;
        time += x[i];
      }
    }
    time += s;
    time -= 20;
  }
  return 0;
}
