#include <bits/stdc++.h>
int main(void) {
  int Array[5];
  int max_ = -1;
  int j = -1;
  for (int i = 0; i < 5; ++i) {
    std::cin >> Array[i];
    if (max_ < 10 - Array[i] % 10) {
      j = i;
      max_ = 10 - Array[i] % 10;
    }
  }
  int count = 0;
  for (int i = 0; i < 5; ++i) {
    if (i == j) count += Array[i];
    count += Array[i] + 10 - Array[i] % 10;
  }
  std::cout << count << std::endl;
  return 0;
}
