#include <bits/stdc++.h>
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;
int main() {
  vt<int> m(5);
  int num, k = 9;
  for (int i = 0; i < (int)5; i++) {
    std::cin >> m[i];
    if (k > m[i] % 10 && m[i] % 10 != 0) {
      k = m[i] % 10;
      num = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)5; i++) {
    if (i == num)
      continue;
    else if (m[i] % 10 != 0)
      m[i] += 10 - (m[i] % 10);
    ans += m[i];
  }
  std::cout << ans + m[num] << '\n';
  return 0;
}
