Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Intersection

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given two set of points. The first set is determined by the equation *A*_{1}*x* + *B*_{1}*y* + *C*_{1} = 0, and the second one is determined by the equation *A*_{2}*x* + *B*_{2}*y* + *C*_{2} = 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 *A*_{1}, *B*_{1}, *C*_{1} separated by space. The second line contains three integer numbers *A*_{2}, *B*_{2}, *C*_{2} 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

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/27/2017 04:20:13 (c3).

Desktop version, switch to mobile version.
User lists

Name |
---|