#include <bits/stdc++.h>
void QSort(int *x, int *y, int left, int right) {
  int i, j;
  int pivot;
  i = left;
  j = right;
  pivot = x[(left + right) / 2];
  while (1) {
    while (x[i] < pivot) i++;
    while (pivot < x[j]) j--;
    if (i >= j) break;
    int temp;
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
    temp = y[i];
    y[i] = y[j];
    y[j] = temp;
    i++;
    j--;
  }
  if (left < i - 1) QSort(x, y, left, i - 1);
  if (j + 1 < right) QSort(x, y, j + 1, right);
}
int main() {
  int num[5] = {};
  int num2[5] = {};
  int numID[5] = {};
  int min = 0;
  int sum = 0;
  int flag = 0;
  for (int i = 0; i < 5; i++) {
    std::cin >> num[i];
    num2[i] = num[i] % 10;
    numID[i] = i;
  }
  for (int i = 0; i < 5; i++) {
    std::cout << num[i] << std::endl;
  }
  QSort(num2, numID, 0, 4);
  for (int i = 0; i < 5; i++) {
    if (num[numID[i]] % 10 == 0) {
    } else if (num[numID[i]] % 10 != 0 && flag == 0) {
      flag++;
    } else {
      num[numID[i]] += 10 - (num[numID[i]] % 10);
    }
  }
  int count = 0;
  for (int i = 0; i < 5; i++) {
    if (num2[i] == 0) {
      sum += num[numID[i]];
      count++;
    }
  }
  int j = 4;
  for (int i = 4; i >= 0; i--) {
    if (num2[i] != 0) {
      sum += num[numID[i]];
    }
  }
  std::cout << sum << std::endl;
}
