// Defines some helpful methods 	
	
public class Tools {	
	// min(): returns the min of its three parameters	
	public static int min(int a, int b, int c) {	
		return Math.min(a, Math.min(b, c));	
	}	
	
	// min(): returns the min of its four parameters	
	public static int min(int a, int b, int c, int d) {	
		return Math.min(a, min(b, c, d));	
	}	
	
	// power(): returns x ^ n	
	public static int power(int x, int n) {	
		int result = 1;	
		for (int i = 1; i <= n; ++i) {	
			result *= x;	
		}	
		return result;	
	}	
	
	// power(): returns x ^ n	
	public static double power(double x, int n) {	
		double result = 1;	
		for (int i = 1; i <= n; ++i) {	
			result *= x;	
		}	
		return result;	
	}	
	
	// isInteger(): returns whether s is a number 	
	public static boolean isInteger(String s) {	
		// is there a nonempty string to consider 	
		if ((s == null) || (s.length() == 0)) {	
			return false;	
		}	
	
		// ignore sign if there is one 	
		if ((s.charAt(0) == '+') || (s.charAt(0) == '-')) {	
			s = s.substring(1);	
			// make sure what's left is nonempty	
			if (s.length() == 0) {	
				return false;	
			}	
		}	
	
		// make sure the rest is digits 	
		for (int i = 0; i < s.length(); ++i) {	
			// is current character a digit	
			if (! Character.isDigit(s.charAt(i))) {	
				return false;	
			}	
		}	
	
		// number checked out 	
		return true;	
	}	
}	
	
