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