import java.io.*; import java.util.*; import java.awt.geom.*; /** * Solution to The Magical 3 * * @author vanb */ public class magical3_vanb { public Scanner sc; public PrintStream ps; /** * Driver. * @throws Exception */ public void doit() throws Exception { sc = new Scanner( System.in ); ps = System.out; // We're going to need a list of primes. boolean isprime[] = new boolean[60000]; Arrays.fill( isprime, true ); isprime[0] = false; isprime[1] = false; long primes[] = new long[50000]; int np=0; // Yeah, yeah, 4, 6 and 9 are not primes. // But, they are the only non-prime numbers that can be // an answer to this problem. primes[np++] = 4L; primes[np++] = 5L; primes[np++] = 6L; primes[np++] = 7L; primes[np++] = 9L; for( int i=2; i9 )primes[np++] = i; for( int j=i+i; j3 ) answer = target/2; if( target%3==0 && target/3>3 ) answer = target/3; } ps.println( answer ); } /** * @param args */ public static void main( String[] args ) throws Exception { new magical3_vanb().doit(); } }