#include <bits/stdc++.h>
using namespace std;

int main() {
  int s = 10;
  int t = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    if (x%10!=0) s = min(s,x%10);
    t += ((x-1)/10+1)*10;
  }
  cout << t-10+s << endl;
}