unittest
{
	assert( [ "2 3 4", "100", "600", "400", "900", "1000", "150", "2000", "899", "799" ].solve == "350\n1400\n301\n399" );
	assert( [ "1 1 3", "1", "10000000000", "2", "9999999999", "5000000000" ].solve == "10000000000\n10000000000\n14999999998" );
}



import std.algorithm;
import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;

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

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto a = 0L;
	auto b = 0L;
	auto q = 0L;
	input.front.formattedRead!"%s %s %s"( a, b, q );
	auto ss = new long[ a ];
	foreach( ref s; ss )
	{
		input.popFront;
		s = input.front.to!( long );
	}
	auto ts = new long[ b ];
	foreach( ref t; ts )
	{
		input.popFront;
		t = input.front.to!( long );
	}
	auto xs = new long[ q ];
	foreach( ref x; xs )
	{
		input.popFront;
		x = input.front.to!( long );
	}
	
	auto anss = new long[ q ];
	auto ss_s = ( -10L ^^ 16 ~ ss ~ 10L ^^ 16 ).assumeSorted;
	auto ts_s = ( -10L ^^ 16 ~ ts ~ 10L ^^ 16 ).assumeSorted;
	foreach( ref ans, x; lockstep( anss, xs ) )
	{
		auto si = ss_s.lowerBound( x ).length.signed;
		auto sl = x - ss_s[ si - 1 ];
		auto sr = ss_s[ si ] - x;
		auto ti = ts_s.lowerBound( x ).length.signed;
		auto tl = x - ts_s[ ti - 1 ];
		auto tr = ts_s[ ti ] - x;
		ans = min( max( sl, tl ), max( sr, tr ), sl * 2 + tr, sl + tr * 2, tl * 2 + sr, tl + sr * 2 );
	}
	return anss.to!( string[] ).join( "\n" );
}
