#include<stdio.h>
#include<stdlib.h>

int main()
{
	int a, b, c, d, e, i, j, temp;
	int array[5];
	scanf_s("%d", &a);
	scanf_s("%d", &b);
	scanf_s("%d", &c);
	scanf_s("%d", &d);
	scanf_s("%d", &e);
	array[0] = a % 10;
	array[1] = b % 10;
	array[2] = c % 10;
	array[3] = d % 10;
	array[4] = e % 10;
	for (i = 0; i < 4; i++)
		for (j = 0; j < 4; j++) {
			if (array[j + 1] < array[j]) {
				temp = array[j]; array[j] = array[j + 1]; array[j + 1] = temp;
			}
		}
	
	
printf("%d", a + b + c + d + e + 40 - array[1] - array[2] - array[3] - array[4]);


	return 0;
}