Guyz, im trying to figure out how to find solutions to there two problems

1.

Consider a field which is square in shape and 100*100 units in area . I am standing at the North-West corner of the field . From any place I am allowed to take one of the following 3 moves

1) 1 unit to the East

2) 1 unit to the South

3) sqrt(2) units to the South-East

I am not allowed to move out of the field.

I randomly pick one of the possible moves at each step and reach the South-East corner of the field ? The odds that I took the shortest path are 1:x

Find x .

2.

For a prime number p the set of co-primes less than or equal to it is given by {1,2,3,4,...p-1} .

We define f(x,p) 0<x<p = 1 if and only if all the numbers from 1 to p-1 can be written as a power of x in modulo-p arithmetic .

Let n be the largest 12-digit prime number . Find the product of all integers j less than n such that f(j,n)=1, in modulo-n arithmetic

the second one is very difficult.