unittest
{
	assert( [ "5", "3", "2", "4", "3", "5" ].solve == 7 );
	assert( [ "10", "123", "123", "123", "123", "123" ].solve == 5 );
	assert( [ "10000000007", "2", "3", "5", "7", "11" ].solve == 5000000008 );
}



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 n = input.front.to!( long );
	auto abcde = new long[ 5 ];
	foreach( ref x; abcde )
	{
		input.popFront;
		x = input.front.to!( long );
	}
	
	auto ans = 0L;
	auto m = n;
	foreach( i, x; abcde )
	{
		if( x < m )
		{
			ans = i.signed + n / x;
			m = x;
		}
		ans++;
	}
	return ans;
}
