#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  for (int i = 0; i < 5; i++) cin >> a[i];
  int ans = 0;
  int min_1 = 9;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0)
      ans += a[i];
    else {
      ans += a[i] - a[i] % 10 + 10;
      min_1 = min(min_1, a[i] % 10);
    }
  }
  ans = ans - 10 + min_1;
  cout << ans << endl;
}
