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


int main() {
  int A,B,C,D,E;
  cin >> A >> B >> C >> D >>E;
int minimini = min({(A-1)%10,(B-1)%10,(C-1)%10,(D-1)%10,(E-1)%10});
int amari = 10-minimini-1;

cout << (A-1)/10*10+(B-1)/10*10+(C-1)/10*10+(D-1)/10*10+(E-1)/10*10+50-amari <<endl;




  }