
# total_steps[n][m] is a location on the board
def calculate_steps(n,m):
  total_steps = []
  total_steps.append(m*[1])
  for i in range(n-1):
    total_steps.append([1] + (m-1) * [0])

  return find_steps(n-1, m-1, total_steps)

def find_steps(n,m, board):
  print board
  if board[n][m] == 0:
    ans = find_steps(n-1, m, board) + find_steps(n, m-1, board)
    board[n][m] = ans
    return ans
  else:
    return board[n][m]



print calculate_steps(3,3)


