#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], ans = 0, k = 1000, c = 0;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (int i = 0; i < 5; i++)
    if (a[i] % 10 != 0 && a[i] % 10 < k) k = a[i], c = i;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0 || i == c)
      ans += a[i];
    else
      ans += (a[i] / 10 + 1) * 10;
  }
  cout << ans;
}
