unittest
{
	assert( [ "3", "5", "10","15" ].parse.expand.solve == 25 );
	assert( [ "3", "10", "10", "15" ].parse.expand.solve == 35 );
	assert( [ "3", "10", "20", "30" ].parse.expand.solve == 0 );
}



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

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

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

auto solve( long[] ss )
{
	auto t = ss.sum;
	if( t % 10 != 0 ) return t;
	
	auto s = ss.sort().filter!( ( s ) => ( t - s ) % 10 != 0 ).takeOne;
	if( s.empty ) return 0;
	else          return t - s.front;
}
