#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int ans = a + b + c + d + e;
  int maximum;
  maximum = min(a % 10, b % 10);
  maximum = min(maximum, c % 10);
  maximum = min(maximum, d % 10);
  maximum = min(maximum, e % 10);
  ans += 40 - (a % 10 + b % 10 + c % 10 + d % 10 + e % 10) + maximum % 10;
  cout << ans << endl;
}
