#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec;
  vector<int> amari;
  int ans;
  for (int i = 0; i < (int)(5); i++) {
    cin >> vec[i];
    ans += (vec[i] + 10 - vec[i] % 10);
    amari[i] = vec[i] % 10;
  }
  sort(amari.begin(), amari.end());
  cout << ans - 10 + amari[0];
}
