protect-the-bad-when-weak-3

Reverse_flash lost his power while moving through a number of timezones and landed in the timezone of Flash. Now we know that Flash would kill him as soon as he finds him.
Your job is to protect the bad.
The timezone of Flash is  (1,1). There is a safe timezone (n,n), the last one ,where Flash couldn't enter.
Timezone which Reverse_flash could pass through/enter is represented by 0 and which he couldn't is represented by 1.Now your task to find the possible number of ways to reach timezone (n,n) from (1,1).
Input format & constraints
1st line --> integer value 'n'  (n ≤ 100) denoting the size of the grid of timezones.
Next n lines -->each line contains n space separated integers either 1 or 0.
Output format
A line with possible number of ways you could protect bad from good i.e, all possible ways you could make him reach (n,n) from (1,1).
Note Reverse_Flash could only move either horizontally or vertically i.e, not diagonally :)

SAMPLE INPUT
7
0 0 0 0 0 0 0
0 1 0 1 0 1 0
0 0 0 0 0 0 0
0 1 0 1 0 1 0
0 0 0 0 0 0 0
0 1 0 1 0 1 0
0 0 0 0 0 0 0

SAMPLE OUTPUT
184

Source: hackerearth | Difficulty: EASY


Solutions:
import sys
sys.setrecursionlimit(10000)
def s(r, c):
	global ans, time_zone, vis, lens, steps
	if r == lens-1 and c == lens - 1:
		ans += 1
		return
	vis[r][c] = True
	for i in range(4):
		nr = r + steps[i][0]
		nc = c + steps[i][1]
		
		if nr < 0 or nc < 0 or nr >= lens or nc >= lens:
			continue
		if vis[nr][nc] or time_zone[nr][nc] == 1:
			continue
		s(nr, nc)
		vis[nr][nc] = False
	  
	  
n = eval(input())
time_zone = []
ans = 0
for i in range(n):
	tmp = []
	tmp = list(map(int, input().split()))
	time_zone.append(tmp)
lens = len(time_zone[0]) 
vis = [[0 for x in range(lens)] for y in range(lens)]
steps = [(1, 0), (-1, 0), (0, 1), (0, -1)]
s(0, 0)
print(ans)