#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a[5];
  for (int i = 0; i < (5); i++) cin >> a[i];
  int k = 9;
  int ans = 0;
  for (int i = 0; i < (5); i++) {
    if (a[i] % 10 != 0) {
      k = min(k, a[i] % 10);
    }
    ans += 10 * ((a[i] + 9) / 10);
  }
  cout << ans - 10 + k << endl;
  return 0;
}
