#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], k = 0, m = 10, count = 0;
  bool check = true;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0 && a[i] % 10 < m) k = i, m = a[i] % 10;
    if (a[i] % 10 == 0)
      count += a[i];
    else
      count += (a[i] / 10) * 10 + 10;
  }
  cout << count - (10 - a[k] % 10);
}
