
  REP(i,5) {
    if (a[i] % 10 != 0) {
      if (k == -1) k = a[i]%10;
      else k = min(k,a[i]%10);
    }
    ans += 10 * ((a[i] + 9)/10);
  }
  if (k == -1) cout << ans << endl;
  else cout << ans - 10 + k << endl;
  return 0;
}
