unittest
{
	assert( [ "29", "20", "7", "35", "120" ].parse.expand.solve == 215 );
	assert( [ "101", "86", "119", "108", "57" ].parse.expand.solve == 481 );
	assert( [ "123", "123", "123", "123", "123" ].parse.expand.solve == 643 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto ds = new long[ 5 ];
	foreach( ref d; ds )
	{
		d = input.front.to!( long );
		input.popFront;
	}
	return tuple( ds );
}

auto solve( long[] ds )
{
	auto rs = ds.map!( ( a ) => ( a % 10 == 0 ) ? 10L : a % 10 ).array;
	zip( rs, ds ).sort;
	foreach( ref d; ds[ 1 .. $ ] )
	{
		d = ( d + 9 ) / 10 * 10;
	}
	return ds.sum;
}
