#include <iostream>

using namespace std;

int main() {
  int sum = 0, mx = 0;
  for (int i = 0; i < 5; ++i) {
    int a;
    cin >> a;
    sum += (a + 9) / 10;
    mx = max(mx, (10 - a % 10)%10);
  }
  cout<<sum*10-mx<<endl;
}
