unittest
{
	assert( [ "90" ].solve == 4 );
	assert( [ "1" ].solve == 360 );
}



import std.conv;
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 x = input.front.to!( long );
	
	return lcm( x, 360 ) / x;
}

// 最小公倍数
auto lcm( long x, long y )
{
	import std.numeric;
	return x * y / x.gcd( y );
}
