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