#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5];
  int kiroku = 9;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 < kiroku && a[10] % 10 != 0) {
      kiroku = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i = kiroku)
      continue;
    else if (a[i] % 10 != 0) {
      ans += (a[i] % 10 + 1) * 10;
    } else
      ans += a[i];
  }
  ans += a[kiroku];
  cout << ans << endl;
  return 0;
}
