#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e10;
void solve() {
  int sum = 0;
  for (int i = 1; i <= 5; i++) {
    int x;
    cin >> x;
    sum += x;
    x %= 10;
    if (x > 0 && i < 5) sum += 10 - x;
  }
  cout << sum;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
