public static boolean TestMagic(int M,int distance,int time){
		if(time <= T){
			longdistance=longdistance>distance?longdistance:distance;
			System.out.println("longdistance= "+longdistance);
		}
			
		if(distance >= S){
			mintime=mintime>time?time:mintime;
			System.out.println("mintime= "+mintime);
			return true;
		}
		if(M>=10)
			TestMagic(M-10, distance+60, time+1);
		else {
			TestMagic(M, distance+17, time+1);
			TestMagic(M+4, distance, time+1);
		}
		return true;
	}