21_B. Intersection
You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0.

Write the program which finds the number of points in the intersection of two given sets.

Input

The first line of the input contains three integer numbers A1, B1, C1 separated by space. The second line contains three integer numbers A2, B2, C2 separated by space. All the numbers are between -100 and 100, inclusive.

Output

Print the number of points in the intersection or -1 if there are infinite number of points.

Examples

Input

1 1 0
2 2 0


Output

-1


Input

1 1 0
2 -2 0


Output

1
```python
a1, b1, c1 = [int(i) for i in input().split()]
a2, b2, c2 = [int(i) for i in input().split()]

if c1 != c2 and (a1 == 0 and b1 == 0) and (a2 == 0 and b2 == 0) :
    print(0)
elif (a1 == 0 and b1 == 0 and c1 == 0) or (a2 == 0 and b2 == 0 and c2 == 0) :
    print(-1)
elif (a1 == 0 and b1 == 0 and c1 != 0) or (a2 == 0 and b2 == 0 and c2 != 0) and (c1 == c2):
    print(0)
elif a1 * b2 == b1 * a2 and b2 * c1 == c2 * b1 and c1 * a2 == c2 * a1 :
    print(-1)
elif ((a1 * b2) - (a2 * b1)) == 0:
    print(0)
else:
    print(1)
		 	   		 			  					    	 		
```