#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const long long int INF = 1e18;
int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int ans = 0, sub = 10;
  for (int i = (0); i < (5); i++) sub = min(sub, (a[i] - 1) % 10);
  sub++;
  bool flag = true;
  for (int i = (0); i < (5); i++) {
    if (sub != a[i] % 10 || !(flag)) {
      ans += ((a[i] + 9) / 10) * 10;
      flag = false;
    } else
      ans += a[i];
    flag = false;
  }
  cout << ans << endl;
  return 0;
}
