Given two coordinates (x, y) and (a, b). Find if it is possible to reach (x,y) from (a,b).
Only possible moves from any coordinate (i, j) are-
	(i-j, j)
	(i, i-j)
	(i+j, j)
	(i, i+j)
 
Example 1:
Input:
x = 1, y = 1, a = 2, b = 3
Output:
1
Explanation:
We can reach the point (2,3) from (1,1).
Example 2:
Input:
x = 35, y = 15, a = 20, b = 25
Output:
1
Explanation:
We can reach the point (20,25) from (35,15).
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function isPossible() which takes 4 Integers x, y, a and b as input and returns 1 if it's possible to move to (a,b) from (x,y) else returns 0.
 
Expected Time Complexity: O(log(x))
Expected Auxiliary Space: O(1)
 
Constraints:
-10^{5} <= x,y,a,b <= 10^{5}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(log(x))
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

    def isPossible(self, x, y, a, b):

        # code here 

Solutions:
class Solution:

	def isPossible(self, x, y, a, b):

		def gcd(x, y):
			x = abs(x)
			y = abs(y)
			if x < y:
				(x, y) = (y, x)
			while y:
				(x, y) = (y, x % y)
			return x
		if gcd(x, y) == gcd(a, b):
			return 1
		else:
			return 0


class Solution:

	def isPossible(self, x, y, a, b):

		def gcd(m, n):
			if n == 0:
				return m
			return gcd(n, m % n)
		if abs(gcd(a, b)) == abs(gcd(x, y)):
			return 1
		else:
			return 0


import math

class Solution:

	def isPossible(self, x, y, a, b):

		def gcd(n, m):
			if m == 0:
				return n
			return gcd(m, n % m)
		g = gcd(x, y)
		h = gcd(a, b)
		if abs(g) == abs(h):
			return 1
		return 0


import math

class Solution:

	def isPossible(self, x, y, a, b):
		if math.gcd(x, y) == math.gcd(a, b):
			return 1
		return 0


from math import gcd

class Solution:

	def isPossible(self, x, y, a, b):
		return int(gcd(abs(x), abs(y)) == gcd(abs(a), abs(b)))


class Solution:

	def gcd(self, i, j):
		if i < j:
			(i, j) = (j, i)
		while j:
			(i, j) = (j, i % j)
		return i

	def isPossible(self, x, y, a, b):
		(x, y, a, b) = (abs(x), abs(y), abs(a), abs(b))
		if self.gcd(x, y) == self.gcd(a, b):
			return 1
		return 0


import math

class Solution:

	def isPossible(self, x, y, a, b):
		e = math.gcd(a, b)
		f = math.gcd(x, y)
		if e == f:
			return 1
		else:
			return 0


class Solution:

	def isPossible(self, x, y, a, b):

		def gc(i, j):
			if j == 0:
				return i
			else:
				return gc(j, i % j)
		if gc(abs(x), abs(y)) == gc(abs(a), abs(b)):
			return 1
		else:
			return 0


import math as m

class Solution:

	def isPossible(self, x, y, a, b):
		r = m.gcd(x, y)
		e = m.gcd(a, b)
		if r == e:
			return 1
		else:
			return 0


class Solution:

	def isPossible(self, x, y, a, b):

		def find_gcd(a, b):
			if b == 0:
				return a
			if a == 0:
				return b
			if a > b:
				(a, b) = (b, a)
			return find_gcd(a, b % a)
		if x < 0:
			x = x * -1
		if y < 0:
			y = y * -1
		if a < 0:
			a = a * -1
		if b < 0:
			b = b * -1
		if find_gcd(x, y) == find_gcd(a, b):
			return 1
		return 0


import math

class Solution:

	def isPossible(self, x, y, a, b):
		(gxy, gab) = (0, 0)
		if math.gcd(x, y) == math.gcd(a, b):
			return 1
		else:
			return 0


import math

class Solution:

	def isPossible(self, x, y, a, b):
		k = math.gcd(a, b)
		m = math.gcd(x, y)
		if k == m:
			return 1
		else:
			return 0


class Solution:

	def isPossible(self, x, y, a, b):

		def gcd_(a, b):
			while a and b:
				if a > b:
					a %= b
				else:
					b %= a
			if a:
				return a
			return b
		if gcd_(abs(a), abs(b)) == gcd_(abs(x), abs(y)):
			return 1
		return 0


class Solution:

	def gc(self, n, m):
		while n != 0 and m != 0:
			if n < m:
				m = m % n
			else:
				n = n % m
		if n == 0:
			return m
		else:
			return n

	def isPossible(self, x, y, a, b):
		g = self.gc(x, y)
		c = self.gc(a, b)
		if abs(g) == abs(c):
			return 1
		return 0