#include <bits/stdc++.h>
int main(int argc, char* argv[]) {
  int data[5];
  int base[5];
  int remain[5];
  int result;
  int sum0 = 0;
  int sum1 = 0;
  int sum2 = 0;
  int remain_min = 10;
  int remain_cnt = 0;
  result = 0;
  for (int n = 0; n < 5; n++) {
    scanf("%d", &data[n]);
    base[n] = 10 * (data[n] / 10);
    remain[n] = data[n] % 10;
    sum0 += data[n];
    sum1 += base[n];
    sum2 += remain[n];
    if (remain[n] > 0) {
      remain_cnt++;
      if (remain_min > remain[n]) {
        remain_min = remain[n];
      }
    }
    result += base[n];
  }
  if (remain_min == 10) {
    remain_min = 0;
  }
  result += (remain_cnt - 1) * 10 + remain_min;
  printf("%d\n", result);
  return 0;
}
