#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, ans = 0;
  int k = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> a;
    if (a % 10 != 0 && 10 - a % 10 > k) k = 10 - a % 10;
    ans += a + 10 - a % 10;
  }
  cout << ans - k << endl;
}
