#include <bits/stdc++.h>
int main() {
  int d[5];
  int min = 10;
  int time = 0;
  std::cin >> d[0] >> d[1] >> d[2] >> d[2] >> d[3] >> d[4];
  for (int i = 0; i < 5; i++) {
    if (min >> d[i] % 10) {
      min = d[i] % 10;
    }
    time += d[i];
  }
  time = time - (10 - min);
  std::cout << time << std::endl;
  return 0;
}
