```
class Solution(object):
def uniquePathsWithObstacles(self, obstacleGrid):
"""
:type obstacleGrid: List[List[int]]
:rtype: int
"""
og = obstacleGrid
for i in range(len(og)):
for j in range(len(og[0])):
if og[i][j] == 1:
og[i][j] = 0
elif i == 0 and j == 0:
og[i][j] = 1
elif i == 0:
og[i][j] = og[i][j-1]
elif j == 0:
og[i][j] = og[i-1][j]
else:
og[i][j] = og[i-1][j] + og[i][j-1]
return og[-1][-1]
```