unittest
{
	assert( [ "7 5 1" ].parse.expand.solve == "YES" );
	assert( [ "2 2 1" ].parse.expand.solve == "NO" );
	assert( [ "1 100 97" ].parse.expand.solve == "YES" );
	assert( [ "40 98 58" ].parse.expand.solve == "YES" );
	assert( [ "77 42 36" ].parse.expand.solve == "NO" );
}



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

auto solve( long a, long b, long c )
{
	auto rs = [ a % b ];
	while( true )
	{
		auto r = ( rs[ $ - 1 ] + a ) % b;
		if( r == c ) return "YES";
		if( 0 < rs.count( r ) ) return "NO";
		rs ~= r;
	}
	assert( false );
}
