#include <bits/stdc++.h>
using namespace std;
signed long long int a[100005];
multiset<signed long long int> ms;
multiset<signed long long int>::iterator it;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  signed long long int k = 0, mn = 10, h = 0, m = 1;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (signed long long int i = 0; i <= 4; i++) {
    if (a[i] % 10 < mn && a[i] % 10 != 0) {
      mn = a[i] % 10;
      h = a[i];
    }
  }
  for (signed long long int i = 0; i <= 4; i++) {
    if (a[i] % 10 > mn || (a[i] % 10 == mn && a[i] != h)) {
      k += a[i] - a[i] % 10 + 10;
    } else {
      k += a[i];
    }
  }
  cout << k;
}
