unittest
{
	assert( [ "3", "10 2 5", "6 3 4" ].parse.expand.solve == 5 );
	assert( [ "4", "13 21 6 19", "11 30 6 15" ].parse.expand.solve == 6 );
	assert( [ "1", "1", "50" ].parse.expand.solve == 0 );
}



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 n = input.front.to!( long );
	input.popFront;
	auto vs = input.front.split.to!( long[] );
	input.popFront;
	auto cs = input.front.split.to!( long[] );
	return tuple( vs, cs );
}

auto solve( long[] vs, long[] cs )
{
	auto x = 0L;
	auto y = 0L;
	foreach( v, c; lockstep( vs, cs ) )
	{
		auto xn = x + v;
		auto yn = y + c;
		if( x - y < xn - yn )
		{
			x = xn;
			y = yn;
		}
	}
	return x - y;
}
