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

int main(){
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int adtime = min({(a-1)%10, (b-1)%10, (c-1)%10, (d-1)%10, (e-1)%10})+1;
  int ans = (a+9)/10*10+(b+9)/10*10+(c+9)/10*10+(d+9)/10*10+(e+9)/10*10-(10-adtime);
  cout << ans << endl;
}