unittest
{
	assert( [ "1 1" ].parse.expand.solve == 1000000 );
	assert( [ "3 101" ].parse.expand.solve == 100000 );
	assert( [ "4 4" ].parse.expand.solve == 0 );
}



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 xy = input.front.split.to!( long[] );
	return tuple( xy[ 0 ], xy[ 1 ] );
}

auto solve( long x, long y )
{
	return max( 0, 400000 - 100000 * x ) + max( 0, 400000 - 100000 * y ) + ( 400000 * ( x == 1 && y == 1 ) );
}
