//package com.nektra.googletreasurehunt;

import java.math.BigInteger;

public class Question1 {

	/**
	 * @param args {rows, columns}
	 * 
	 */
	public static void main(String[] args) {
		/**
		 * The problem gets solved using the following equation:
		 * 		#paths = (m + n)! / (m! * n!)
		 * You can find the solution searching in Google:
		 * 		"grid path right down"
		 * So lame...
		 */  
		int rows = 50;
		int columns = 65;
		if(args.length > 0)
		{
			rows = Integer.parseInt( args[0] );
			columns = Integer.parseInt( args[1] );;
		}
		BigInteger dividend = factorial( (rows-1)+(columns-1) );
		BigInteger divisor = factorial(rows-1).multiply(factorial(columns -1));
		System.out.println(dividend);
		System.out.println(divisor);
		System.out.println(dividend.divide(divisor));
		//System.out.println( (factorial( (rows-1)+(columns-1) )).divide( factorial(rows-1).multiply(factorial (columns -1) ) ).toString()  );
	}

	public static BigInteger factorial(int factor)
	{
		BigInteger n = BigInteger.ONE;
		for (int i = 1; i <= factor; i++ )
		{
			n = n.multiply(BigInteger.valueOf(i));
		}
		return n;
	}
}
