#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long a[1111];
  long long min = 2147483647, ans = 0;
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0)
      ans += (a[i] / 10) * 10 + 10;
    else
      ans += a[i];
    min = std::min(a[i] % 10, min);
  }
  ans -= (10 - min);
  cout << ans << endl;
}
