#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int ans = 0;
  for (int i = 0; i < 5; ++i) ans += (a[i] + 9) / 10 * 10;
  int subt = 0;
  for (int i = 0; i < 5; ++i) subt = max(subt, 10 - (a[i] % 10));
  ans -= subt;
  cout << ans << endl;
}
