#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout.setf(ios_base::fixed, ios_base::floatfield);
  int a[5];
  for (int i = 0; i < 5; i++) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < 5; i++) ans += (a[i] + 9) / 10 * 10;
  int t = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) continue;
    t = max(t, 10 - a[i] % 10);
  }
  cout << ans - t << endl;
  return 0;
}
