#include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <deque>

using namespace std;

#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;

const int MAXN = 1e3+5;
const double EPS = 1e-9;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ll a1,a2,b1,b2,c1,c2;
	cin>>a1>>b1>>c1;
	cin>>a2>>b2>>c2;

	if(a1==0 && b1==0 && c1!=0)
	{
		printf("0");
		return 0;
	}
	if(a2==0 && b2==0 && c2!=0)
	{
		printf("0");
		return 0;
	}
	if(a1*b2!=a2*b1)
	{
		printf("1");
	}
	else
	{
		if(b1*c2!=b2*c1 || a1*c2!=a2*c1) printf("0");
		else printf("-1");
	}
	return 0;
}

#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
typedef long long ll;
using namespace std;

int i, j, k, n;

int A1, B1, C1, A2, B2, C2;

void ans(int x) {
    cout << x << endl;
    exit(0);
}

void solve(int A, int B, int C) {
    if (A == 0 && B == 0) {
        if (C == 0) ans(-1);
        else ans(0);
    }
    ans(-1);
}

void solve() {
    if (A1 == 0 && B1 == 0) {
        if (C1 != 0) ans(0);
        else solve(A2, B2, C2);
    } else if (A2 == 0 && B2 == 0) {
        if (C2 != 0) ans(0);
        else solve(A1, B1, C1);
    }
    int D = A1 * B2 - A2 * B1;
    if (D != 0) ans(1);
    if (B1 * C2 == B2 * C1 && A1 * C2 == A2 * C1) ans(-1);
    else ans(0);
}

int main() {

    cin >> A1 >> B1 >> C1 >> A2 >> B2 >> C2;

    solve();

    return 0;
}

#define _CRT_SECURE_NO_DEPRECATE

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include <iostream>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <cctype>
#include <sstream>
#include <cassert>
#include <bitset>
#include <memory.h>

using namespace std;

#pragma comment(linker, "/STACK:200000000")

typedef long long int64;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define fore(i, a, n) for(int i = (int)(a); i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define last(a) (int(a.size()) - 1)
#define all(a) a.begin(), a.end()

const double EPS = 1E-9;
const int INF = 1000000000;
const int64 INF64 = (int64) 1E18;
const double PI = 3.1415926535897932384626433832795;

int gcd(int a, int b) {
    return (a == 0 ? b : gcd(b % a, a));
}

void norm(int &a, int &b, int &c) {
    int t = gcd(gcd(abs(a), abs(b)), abs(c));
    a /= t;
    b /= t;
    c /= t;

    if (mp(mp(a, b), c) < mp(mp(0, 0), 0)) {
        a *= -1;
        b *= -1;
        c *= -1;
    }
}

int main() {
#ifdef RADs_project
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif

    int a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;

    bool v1 = (a1 == 0 && b1 == 0);
    bool v2 = (a2 == 0 && b2 == 0);

    if (v1 && v2) {
        if (c1 != 0 || c2 != 0)
            puts("0");
        else
            puts("-1");
        return 0;
    }

    if (v1 || v2) {
        if (!v1) {
            swap(v1, v2);
            swap(a1, a2);
            swap(b1, b2);
            swap(c1, c2);
        }
        if (c1 == 0)
            puts("-1");
        else
            puts("0");
        return 0;
    }

    norm(a1, b1, c1);
    norm(a2, b2, c2);

    if (a1 * b2 == a2 * b1)
        if (a1 == a2 && b1 == b2 && c1 == c2)
            puts("-1");
        else
            puts("0");
    else
        puts("1");

    return 0;
}

#include<string>
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string.h>
#include<memory.h>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#include<numeric>
#include<deque>
#include<set>
#include<functional>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define RITT(it,v,c) for(__typeof(c.begin()) it = v;it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))
#define auto(c) __typeof(c.begin())

using namespace std;
typedef vector<int> vi;
typedef pair<int,int>ii;
typedef vector<pair<int,int> >vpii;
typedef long long llint;

int main(){
    int A1,B1,C1,A2,B2,C2;
    cin>>A1>>B1>>C1>>A2>>B2>>C2;
    if(A1==0 && B1==0 && C1!=0){
        cout<<0;
        return 0;
    }
    if(A2==0 && B2==0 && C2!=0){
        cout<<0;
        return 0;
    }
    if(A1*B2 != A2*B1){
        cout<<1;
        return 0;
    }
    if(A1!=0){
        if(A1*C2 == A2*C1) cout<<-1;
        else cout<<0;
        return 0;
    }
    if(B1*C2 == B2*C1) cout<<-1;
    else cout<<0;
    return 0;
}

#include<bits/stdc++.h>
#include<conio.h>
#define fr first
#define sc second
#define pb push_back
#define ppb pop_back
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main()
{
	int a1,a2,b2,b1,c1,c2;
	cin>>a1>>b1>>c1>>a2>>b2>>c2;
	if((a1*b2-(a2*b1)==0 && c1*b2-(c2*b1)!=0) || (a1*b2-(a2*b1)==0 && a1*c2-(a2*c1)!=0)
	|| (a1==0 && b1==0 && c1!=0)||(a2==0 && b2==0 && c2!=0)){cout<<0;return 0;}
	if((a1*b2-(a2*b1)==0 && c1*b2-(c2*b1)==0) || (a1*b2-(a2*b1)==0 && a1*c2-(a2*c1)==0)){cout<<-1;return 0;}
	else cout<<1;
}

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define ll long long
int gcd(int a, int b) {
	a = abs(a), b = abs(b);
	return (!a) ? b : gcd(b%a, a);
}
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a1, b1, c1, a2, b2, c2;
	cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
	if (a1 == 0 && b1 == 0) {

		if (c1 != 0 || a2==0 && b2==0 && c2!=0) cout << "0";
		else cout << "-1";
		return 0;
	}
	if (a2 == 0 && b2 == 0) {
		if (c2 != 0 ) cout << "0";
		else cout << "-1";
		return 0;
	}
	if (a1*b2 == a2*b1) {
		if (b2*c1 == b1*c2 && a1*c2 == a2*c1) {
			cout << "-1";
		}
		else {
			cout << "0";
		}
	}
	else {
		cout << "1";
	}
}
//15

#include <iostream>

using namespace std;
int main(){
	double a1,b1, c1, a2, b2, c2;
	cin>> a1>> b1>> c1;
	cin>> a2>> b2>> c2;

	if(b1!=0) {
		if (b2!=0){
			if (a1/b1==a2/b2 && c1/b1==c2/b2) {cout<<"-1"<<endl; return 0;}
			else if ((a1/b1==a2/b2 && c1/b1!=c2/b2)) {cout<<"0"<<endl; return 0;}
			else {cout<<"1"<<endl; return 0;}
		} else {
			if (a2==0&&c2!=0) {cout<<"0"<<endl; return 0;}
			else if (a2==0&&c2==0)  {cout<<"-1"<<endl; return 0;}
			else {cout<<"1"<<endl; return 0;}
		}
	} else{
		if (b2!=0){
			if (a1==0&&c1!=0) {cout<<"0"<<endl; return 0;}
			else if (a1==0&&c1==0)  {cout<<"-1"<<endl; return 0;}
			else {cout<<"1"<<endl; return 0;}
		} else {
			if (a1==0){
				if(a2==0){
					if (c1!=0 ||c2!=0) {cout<<"0"<<endl; return 0;}
					else {cout<<"-1"<<endl; return 0;}
				}else{
					if (c1==0){cout<<"-1"<<endl; return 0;}
					else{cout<<"0"<<endl; return 0;}
				}
			} else {
				if(a2==0){
					if (c2==0){cout<<"-1"<<endl; return 0;}
					else{cout<<"0"<<endl; return 0;}
				}else{
					if (c1/a1==c2/a2) {cout<<"-1"<<endl; return 0;}
					else  {cout<<"0"<<endl; return 0;}
				}
			}

		}
	}

	return 0;
}

/***************************************
      zzblack                         **
      2016-04-28                      **
      Orz                             **
****************************************/
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
#define ls id<<1,l,mid
#define rs id<<1|1,mid+1,r
#define OFF(x) memset(x,-1,sizeof x)
#define CLR(x) memset(x,0,sizeof x)
#define MEM(x) memset(x,0x3f,sizeof x)
typedef long long ll ;
typedef pair<int,int> pii ;
const int maxn = 1e5 + 50 ;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 62;
const int inf = 0x3f3f3f3f ;
const int MOD = 1e9+7 ;

inline int read(){
    char c = getchar();
    while (!isdigit(c)) c = getchar();
    int x = 0;
    while (isdigit(c)) {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x;
}

int a[2], b[2], c[2];

int main () {
#ifdef LOCAL
	freopen("C:\\Users\\zzblack\\Desktop\\case.in","r",stdin);
//      freopen("C:\\Users\\zzblack\\Desktop\\case.out","w",stdout);
#endif
	for (int i = 0; i < 2; i++) cin >> a[i] >> b[i] >> c[i];
	int t = __gcd(__gcd(a[0], b[0]), c[0]);
	int tt = __gcd(__gcd(a[1], b[1]), c[1]);
	bool Legal = 1;
	for (int i = 0; i < 2; i++) if (a[i] == 0 && b[i] == 0 && c[i] != 0) Legal = 0;
	if (Legal == 0) {
        puts("0");
        return 0;
	} else if (t == 0 || tt == 0) {
        puts("-1");
        return 0;
	}
	a[0] /= t, b[0] /= t, c[0] /= t;
	a[1] /= tt, b[1] /= tt, c[1] /= tt;
	bool Equal = 0, Par = 0;
	if (a[0] == a[1] && b[0] == b[1] && c[0] == c[1]) Equal = 1;
	else if (a[0] * b[1] == a[1] * b[0]) Par = 1;
	if (Equal) puts("-1");
	else if (Par) puts("0");
    else puts("1");
	return 0;
}

/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
int main(){

	#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\sharr\\Documents\\Input.txt", "r", stdin);
	freopen("C:\\Users\\sharr\\Documents\\Output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int a, b, c, x, y, z;
	cin >> a >> b >> c;
	cin >> x >> y >> z;

	if(a == 0 and b == 0 and c != 0 or x == 0 and y == 0 and z != 0) {
		cout << 0 << '\n';
		return 0;
	}

	if(a * y == x * b) {
		if(a * z == x * c and b * z == y * c) {
			cout << -1 << '\n';
			return 0;
		}
		cout << 0 << '\n';
		return 0;
	}

	cout << 1 << '\n';
	return 0;
}

//
//  Created by Running Photon on 2016-04-27
//  Copyright (c) 2015 Running Photon. All rights reserved.
//
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <sstream>
#include <set>
#include <vector>
#include <stack>
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x,begin())
#define ll long long
#define CLR(x) memset(x, 0, sizeof x)
using namespace std;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 10;
const int maxv = 1e3 + 10;
const double eps = 1e-5;

int main() {
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
//	freopen("out.txt","w",stdout);
#endif
//	ios_base::sync_with_stdio(0);
    double a1, b1, c1, a2, b2, c2;
    while(cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2) {
        if(a1 < 0) {a1 = -a1, b1 = -b1, c1 = -c1;}
        else if(a1 == 0 && b1 < 0) b1 = -b1, c1 = -c1;
        if(a2 < 0) {a2 = -a2, b2 = -b2, c2 = -c2;}
        else if(a2 == 0 && b2 < 0) b2 = -b2, c2 = -c2;
        int f = 1;
        if(a1 < eps && abs(b1) < eps && abs(c1) > eps || a2 < eps && abs(b2) < eps && abs(c2) > eps) f = 0;
        double p1 = atan2(b1, a1);
        double p2 = atan2(b2, a2);
        int res;
        if(f == 0) res = 0;
        else if(a1 < eps && abs(b1) < eps && abs(c1) < eps || a2 < eps && abs(b2) < eps && abs(c2) < eps) res = -1;
        else if(abs(p1 - p2) > eps) res = 1;
        else if((a1 > 0 && a2 > 0 || abs(b1) > 0 && abs(b2) > 0) && abs(c1 / max(a1, abs(b1)) - c2 / max(a2, abs(b2))) < eps || abs(c1) < eps && abs(c2) < eps) res = -1;
        else res = 0;
        cout << res << endl;
    }

	return 0;
}

#include <iostream>

using namespace std;

int main() {
 	// a1, b1, c1 = determining points for first equation
  	 // a2, b2, c2 = determining points for second equation
    int a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2; //receive all the variables

    if((a1 == 0 && b1 == 0) && (a2 == 0 && b2 == 0) && c1 != c2) {
// if all the a, b, and c coefficients of first and second equation
    // are all equal to zero
    	cout << 0 << endl; //display 0
    	return 0;
    }

    if((a1 == 0 && b1 == 0 && c1 == 0) || (a2 == 0 && b2 == 0 && c2 == 0)) {
 // if all the a, b, and c coefficients of first and second equation
  	 // are all equal to zero
    	cout << -1 << endl;  //display negative 1
    	return 0;
    }

    if((a1 == 0 && b1 == 0 && c1 != 0) || (a2 == 0 && b2 == 0 && c2 != 0) && (c1 == c2)) {
// if a and b coefficients of both the first and second equation is equal to 0
    	// and the c coefficients of first and second equation is not equal to zero
    	cout << 0 << endl; //display 0
    	return 0;
    }

    if(a1 * b2 == b1 * a2 && b2 * c1 == c2 * b1 && c1 * a2 == c2 * a1) {
    	cout << -1 << endl; //display -1
    	return 0;
    }

    if(((a1 * b2) - (a2 * b1)) == 0) {
    	cout << 0 << endl; //display 0
    	return 0;
    }

    cout << 1 << endl; //display 1
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <memory.h>
typedef long long int64;
typedef unsigned long long uint64;
using namespace std;

int main() {

	int a1, b1, c1, a2, b2, c2;
	cin >> a1 >> b1 >> c1;
	cin >> a2 >> b2 >> c2;

	// impossible ax + by + c = 0
	if ((a1 == 0 && b1 == 0 && c1 != 0) ||
		(a2 == 0 && b2 == 0 && c2 != 0)) {
		cout << 0 << endl;
		return 0;
	}

	if (a1 == 0 && a2 == 0) {
		if (b1 == 0 || b2 == 0) cout << -1 << endl;
		else if (b1 * c2 == b2 * c1) cout << -1 << endl;
		else cout << 0 << endl;
	}
	else if (a1 == 0 || a2 == 0) {
		if (a2 == 0) {
			swap(a1, a2);
			swap(b1, b2);
			swap(c1, c2);
		}
		if (b1 == 0) cout << -1 << endl;
		else cout << 1 << endl;
	}
	else {
		if (b1 == 0 && b2 == 0) {
			if (a1 * c2 == a2 * c1) cout << -1 << endl;
			else cout << 0 << endl;
		}
		else if (b1 == 0 || b2 == 0) {
			cout << 1 << endl;
		}
		else {
			if (a1 * b2 == a2 * b1) {
				if (b1 * c2 == b2 * c1) cout << -1 << endl;
				else cout << 0 << endl;
			}
			else {
				cout << 1 << endl;
			}
		}
	}
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
double a,b,c;
double d,e,f;
int main()
{

    cin>>a>>b>>c>>d>>e>>f;
    if((!a&&!b&&c)||(!d&&!e&&f))
    {

        printf("0");
        return 0;
    }
    if((!a&&!b&&!c)||(!d&&!e&&!f))
    {

        printf("-1");
        return 0;
    }

    if(b==0&&e==0)
    {
        if(a&&d){
       double pp=c/a;
        double qq=f/d;
          if(fabs(pp-qq)<1e-6)
        {
            printf("-1");

        }
        else
            printf("0");
        }
        return 0;
    }
    if(a==0&&d==0)
    {
        if(b&&e){
       double pp=c/b;
        double qq=f/e;
           if(fabs(pp-qq)<1e-6)
        {
            printf("-1");

        }
        else
            printf("0");
        }
        return 0;
    }
    if((a==0&&d)||(d==0&&a))
    {
        printf("%d",1);

        return 0;
    }
    if((b==0&&e)||(e==0&&d))
    {
        printf("%d",1);

        return 0;
    }
    double p=a/b;
    double q=d/e;
    if(p==q)
    {
        double pp=c/a;
        double qq=f/d;
        if(fabs(pp-qq)<1e-6)
        {
            printf("-1");

        }
        else
            printf("0");
        return 0;

    }
    if(p!=q)
    {
        printf("1");
        return 0;
    }

}

//#include "stdafx.h"

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define fo(i,j,n) for(i=j;i<n;++i)
#define Fo(i,j,n) for(i=n-1;i>=j;--i)
#define foo(i,j,v) fo(i,j,sz(v))
#define Foo(i,j,v) Fo(i,j,sz(v))
#define li(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define CLR(a,v) memset((a),(v),sizeof(a))
#define inf 1000000001
//typedef long long Long;
typedef __int64 Long;
#define pi (2*acos(0))
#define eps 1e-9

#define two(X) (1<<(X))
#define twoL(X) (((Long)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)

char BUFFER[100000 + 5];
bool readn(int &n)	{ return scanf("%d",&n) == 1; }
bool readl(Long &n)	{ return scanf("%I64d",&n) == 1; }
bool readd(double &n){ return scanf("%lf",&n) == 1; }
bool reads(string &s){ s = ""; int n = scanf("%s",BUFFER); if(n == 1)s = BUFFER; return n == 1; }
bool readln(string &s){ char *valid = gets(BUFFER); if(valid)s = BUFFER; return ((bool)valid); }

template<class T>
int equation(T A1, T B1, T C1, T A2, T B2, T C2){
    if(A1 == 0 && B1 == 0 && C1 != 0) return 0;
    if(A2 == 0 && B2 == 0 && C2 != 0) return 0;
    if(A1 == 0 && B1 == 0) return -1;
    if(A2 == 0 && B2 == 0) return -1;
    if(A1 * B2 != A2 * B1) return 1;
    if(A1 * C2 == C1 * A2 && B1 * C2 == C1 * B2) return -1;
    return 0;
}

template<class T>
int equation(T &x,T &y,T x1,T y1,T c1,T x2,T y2,T c2)
{
	int cnt = equation(x1,y1,c1,x2,y2,c2);	if(cnt != 1)return cnt;
	T p1,q1,r1,p2,q2,r2;
	if(x1==0) { q1=c1/y1;p1=(c2-(y2*q1))/x2;x=p1;y=q1; return 1;}
	if(y1==0) { p1=c1/x1;q1=(c2-(x2*p1))/y2;x=p1;y=q1; return 1;}
	if(x2==0) { q1=c2/y2;p1=(c1-(y1*q1))/x1;x=p1;y=q1; return 1;}
	if(y2==0) { p1=c2/x2;q1=(c1-(x1*p1))/y1;x=p1;y=q1; return 1;}
	p1=x1*y2;q1=y1*y2;r1=c1*y2;
	p2=x2*y1;q2=y2*y1;r2=c2*y1;
	if(q1==q2){p2*=-1;q2*=-1;r2*=-1;}
	p1+=p2;q1+=q2;r1+=r2;
	//if((p1==0)&&(r1==0))return 2;
	//if((p1==0)&&(r1!=0))return 0;
	p1=r1/p1;q1=(c1-(x1*p1))/y1;
	x=p1;y=q1;
	return 1;
}

int main()
{
	//freopen("D://input.txt","r",stdin);
	int a1,b1,c1,a2,b2,c2,n,x,y; readn(a1); readn(b1); readn(c1); readn(a2); readn(b2); readn(c2);

	n = equation(x,y,a1,b1,c1,a2,b2,c2);
	if(n == 2)cout << "-1";
	else cout <<  n;

	printf("\n");
	return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     200010
#define  eps      1e-6
typedef __int64 int64;
int N;
int A1,B1,C1;
int A2,B2,C2;
bool isok()
{
	return B2*C1==B1*C2&&A2*C1==A1*C2;
}
int main()
{
	int i,j,k;
    scanf("%d%d%d",&A1,&B1,&C1);
	scanf("%d%d%d",&A2,&B2,&C2);
	if(A1==0&&B1==0&&A2==0&&B2==0)
	{
		if(C1==0&&C2==0) printf("-1\n");
		else printf("0\n");
		return 0;
	}
	if(A1==0&&B1==0)
	{
		if(C1==0) printf("-1\n");
		else printf("0\n");
		return 0;
	}
	if(A2==0&&B2==0)
	{
		if(C2==0) printf("-1\n");
		else printf("0\n");
		return 0;
	}
	C1=-C1;
	C2=-C2;
	int det = A1*B2 - A2*B1;
    if(det == 0){
		if(isok()) printf("-1\n");
		else printf("0\n");
    }else{
        printf("1\n");
    }
	return 0;
}

#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<queue>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<climits>
#include<complex>
#define mp make_pair
#define pb push_back
using namespace std;
const double eps=1e-8;
const double inf=1e20;
const double pi=acos(-1.0);
const int maxp=1111;
int dblcmp(double d)
{
    if (fabs(d)<eps)return 0;
    return d>eps?1:-1;
}
inline double sqr(double x){return x*x;}
struct point
{
    double x,y;
    point(){}
    point(double _x,double _y):
    x(_x),y(_y){};
    void input()
    {
        scanf("%lf%lf",&x,&y);
    }
    void output()
    {
        printf("%.2f %.2f\n",x,y);
    }
    bool operator==(point a)
    {
        return dblcmp(a.x-x)==0&&dblcmp(a.y-y)==0;
    }
    bool operator<(point a)const
    {
        return dblcmp(a.x-x)==0?dblcmp(y-a.y)<0:x<a.x;
    }
    double len()
    {
        return sqrt(len2());
    }
    double len2()
    {
        return x*x+y*y;
    }
    double distance(point p)
    {
        return sqrt((p.x-x)*(p.x-x)+(p.y-y)*(p.y-y));
    }
    point add(point p)
    {
        return point(x+p.x,y+p.y);
    }
    point sub(point p)
    {
        return point(x-p.x,y-p.y);
    }
    point mul(double b)
    {
        return point(x*b,y*b);
    }
    point div(double b)
    {
        return point(x/b,y/b);
    }
    double dot(point p)
    {
        return x*p.x+y*p.y;
    }
    double det(point p)
    {
        return x*p.y-y*p.x;
    }
    double rad(point a,point b)
    {
        point p=*this;
        return fabs(atan2(fabs(a.sub(p).det(b.sub(p))),a.sub(p).dot(b.sub(p))));
    }
    point trunc(double r)
    {
        r/=len();
        return point(x*r,y*r);
    }
    point rotleft()
    {
        return point(-y,x);
    }
    point rotright()
    {
        return point(y,-x);
    }
    point rotate(point p,double angle)//绕点p逆时针旋转angle角度
    {
        point v=this->sub(p);
        double c=cos(angle),s=sin(angle);
        return point(p.x+v.x*c-v.y*s,p.y+v.x*s+v.y*c);
    }
};
struct line
{
    point a,b;
    line(){}
    line(point _a,point _b)
    {
        a=_a;
        b=_b;
    }
    bool operator==(line v)
    {
        return (a==v.a)&&(b==v.b);
    }
    //倾斜角angle
    line(point p,double angle)
    {
        a=p;
        if (dblcmp(angle-pi/2)==0)
        {
            b=a.add(point(0,1));
        }
        else
        {
            b=a.add(point(1,tan(angle)));
        }
    }
    line(double _a,double _b,double _c)
    {
        if (dblcmp(_a)==0)
        {
            a=point(0,-_c/_b);
            b=point(1,-_c/_b);
        }
        else if (dblcmp(_b)==0)
        {
            a=point(-_c/_a,0);
            b=point(-_c/_a,1);
        }
        else
        {
            a=point(0,-_c/_b);
            b=point(1,(-_c-_a)/_b);
        }
    }
    void input()
    {
        a.input();
        b.input();
    }
    double length()
    {
        return a.distance(b);
    }
    //点和线段关系
    //1 在逆时针
    //2 在顺时针
    //3 平行
    int relation(point p)
    {
        int c=dblcmp(p.sub(a).det(b.sub(a)));
        if (c<0)return 1;
        if (c>0)return 2;
        return 3;
    }
    bool pointonseg(point p)
    {
        return dblcmp(p.sub(a).det(b.sub(a)))==0&&dblcmp(p.sub(a).dot(p.sub(b)))<=0;
    }
    bool parallel(line v)
    {
        return dblcmp(b.sub(a).det(v.b.sub(v.a)))==0;
    }
    //2 规范相交
    //1 非规范相交
    //0 不相交
    int segcrossseg(line v)
    {
        int d1=dblcmp(b.sub(a).det(v.a.sub(a)));
        int d2=dblcmp(b.sub(a).det(v.b.sub(a)));
        int d3=dblcmp(v.b.sub(v.a).det(a.sub(v.a)));
        int d4=dblcmp(v.b.sub(v.a).det(b.sub(v.a)));
        if ((d1^d2)==-2&&(d3^d4)==-2)return 2;
        return (d1==0&&dblcmp(v.a.sub(a).dot(v.a.sub(b)))<=0||
                d2==0&&dblcmp(v.b.sub(a).dot(v.b.sub(b)))<=0||
                d3==0&&dblcmp(a.sub(v.a).dot(a.sub(v.b)))<=0||
                d4==0&&dblcmp(b.sub(v.a).dot(b.sub(v.b)))<=0);
    }
    int linecrossseg(line v)
    {
        int d1=dblcmp(b.sub(a).det(v.a.sub(a)));
        int d2=dblcmp(b.sub(a).det(v.b.sub(a)));
        if ((d1^d2)==-2)return 2;
        return (d1==0||d2==0);
    }
    int linecrossline(line v)
    {
        if ((*this).parallel(v))
        {
            return v.relation(a)==3;
        }
        return 2;
    }
    point crosspoint(line v)
    {
        double a1=v.b.sub(v.a).det(a.sub(v.a));
        double a2=v.b.sub(v.a).det(b.sub(v.a));
        return point((a.x*a2-b.x*a1)/(a2-a1),(a.y*a2-b.y*a1)/(a2-a1));
    }
    double dispointtoline(point p)
    {
        return fabs(p.sub(a).det(b.sub(a)))/length();
    }
    double dispointtoseg(point p)
    {
        if (dblcmp(p.sub(b).dot(a.sub(b)))<0||dblcmp(p.sub(a).dot(b.sub(a)))<0)
        {
            return min(p.distance(a),p.distance(b));
        }
        return dispointtoline(p);
    }
    point lineprog(point p)
    {
        return a.add(b.sub(a).trunc(b.sub(a).dot(p.sub(a))/b.distance(a)));
    }
    point symmetrypoint(point p)
    {
        point q=lineprog(p);
        return point(2*q.x-p.x,2*q.y-p.y);
    }
};
struct cmp
{
    point p;
    cmp(const point &p0){p=p0;}
    bool operator()(const point &aa,const point &bb)
    {
        point a=aa,b=bb;
        int d=dblcmp(a.sub(p).det(b.sub(p)));
        if (d==0)
        {
            return dblcmp(a.distance(p)-b.distance(p))<0;
        }
        return d>0;
    }
};
struct polygon
{
    int n;
    point p[maxp];
    line l[maxp];
    void input()
    {
        for (int i=0;i<n;i++)
        {
            p[i].input();
        }
    }
    void add(point q)
    {
        p[n++]=q;
    }
    void getline()
    {
        for (int i=0;i<n;i++)
        {
            l[i]=line(p[i],p[(i+1)%n]);
        }
    }
    void norm()
    {
        point mi=p[0];
        for (int i=1;i<n;i++)mi=min(mi,p[i]);
        sort(p,p+n,cmp(mi));
    }
    void getconvex(polygon &convex)
    {
        int i,j,k;
        sort(p,p+n);
        convex.n=n;
        for (i=0;i<min(n,2);i++)
        {
            convex.p[i]=p[i];
        }
        if (n<=2)return;
        int &top=convex.n;
        top=1;
        for (i=2;i<n;i++)
        {
            while (top&&convex.p[top].sub(p[i]).det(convex.p[top-1].sub(p[i]))<=0)
                top--;
            convex.p[++top]=p[i];
        }
        int temp=top;
        convex.p[++top]=p[n-2];
        for (i=n-3;i>=0;i--)
        {
            while (top!=temp&&convex.p[top].sub(p[i]).det(convex.p[top-1].sub(p[i]))<=0)
                top--;
            convex.p[++top]=p[i];
        }
    }
    bool isconvex()
    {
        bool s[3];
        memset(s,0,sizeof(s));
        int i,j,k;
        for (i=0;i<n;i++)
        {
            j=(i+1)%n;
            k=(j+1)%n;
            s[dblcmp(p[j].sub(p[i]).det(p[k].sub(p[i])))+1]=1;
            if (s[0]&&s[2])return 0;
        }
        return 1;
    }
    //3 点上
    //2 边上
    //1 内部
    //0 外部
    int relationpoint(point q)
    {
        int i,j;
        for (i=0;i<n;i++)
        {
            if (p[i]==q)return 3;
        }
        getline();
        for (i=0;i<n;i++)
        {
            if (l[i].pointonseg(q))return 2;
        }
        int cnt=0;
        for (i=0;i<n;i++)
        {
            j=(i+1)%n;
            int k=dblcmp(q.sub(p[j]).det(p[i].sub(p[j])));
            int u=dblcmp(p[i].y-q.y);
            int v=dblcmp(p[j].y-q.y);
            if (k>0&&u<0&&v>=0)cnt++;
            if (k<0&&v<0&&u>=0)cnt--;
        }
        return cnt!=0;
    }
    //1 在多边形内长度为正
    //2 相交或与边平行
    //0 无任何交点
    int relationline(line u)
    {
        int i,j,k=0;
        getline();
        for (i=0;i<n;i++)
        {
            if (l[i].segcrossseg(u)==2)return 1;
            if (l[i].segcrossseg(u)==1)k=1;
        }
        if (!k)return 0;
        vector<point>vp;
        for (i=0;i<n;i++)
        {
            if (l[i].segcrossseg(u))
            {
                if (l[i].parallel(u))
                {
                    vp.pb(u.a);
                    vp.pb(u.b);
                    vp.pb(l[i].a);
                    vp.pb(l[i].b);
                    continue;
                }
                vp.pb(l[i].crosspoint(u));
            }
        }
        sort(vp.begin(),vp.end());
        int sz=vp.size();
        for (i=0;i<sz-1;i++)
        {
            point mid=vp[i].add(vp[i+1]).div(2);
            if (relationpoint(mid)==1)return 1;
        }
        return 2;
    }
    //直线u切割凸多边形左侧
    //注意直线方向
    void convexcut(line u,polygon &po)
    {
        int i,j,k;
        int &top=po.n;
        top=0;
        for (i=0;i<n;i++)
        {
            int d1=dblcmp(p[i].sub(u.a).det(u.b.sub(u.a)));
            int d2=dblcmp(p[(i+1)%n].sub(u.a).det(u.b.sub(u.a)));
            if (d1>=0)po.p[top++]=p[i];
            if (d1*d2<0)po.p[top++]=u.crosspoint(line(p[i],p[(i+1)%n]));
        }
    }
    double getcircumference()
    {
        double sum=0;
        int i;
        for (i=0;i<n;i++)
        {
            sum+=p[i].distance(p[(i+1)%n]);
        }
        return sum;
    }
    double getarea()
    {
        double sum=0;
        int i;
        for (i=0;i<n;i++)
        {
            sum+=p[i].det(p[(i+1)%n]);
        }
        return fabs(sum)/2;
    }
    point getbarycentre()
    {
        point ret(0,0);
        double area=0;
        int i;
        for (i=1;i<n-1;i++)
        {
            double tmp=p[i].sub(p[0]).det(p[i+1].sub(p[0]));
            if (dblcmp(tmp)==0)continue;
            area+=tmp;
            ret.x+=(p[0].x+p[i].x+p[i+1].x)/3*tmp;
            ret.y+=(p[0].y+p[i].y+p[i+1].y)/3*tmp;
        }
        if (dblcmp(area))ret=ret.div(area);
        return ret;
    }
    double areaintersection(polygon po)
    {
    }
    double areaunion(polygon po)
    {
        return getarea()+po.getarea()-areaintersection(po);
    }
};
struct circle
{
    point p;
    double r;
    circle(){}
    circle(point _p,double _r):
    p(_p),r(_r){};
    circle(double x,double y,double _r):
    p(point(x,y)),r(_r){};
    circle(point a,point b,point c)
    {
        p=line(a.add(b).div(2),a.add(b).div(2).add(b.sub(a).rotleft())).crosspoint(line(c.add(b).div(2),c.add(b).div(2).add(b.sub(c).rotleft())));
        r=p.distance(a);
    }
    void input()
    {
        p.input();
        scanf("%lf",&r);
    }
    bool operator==(circle v)
    {
        return ((p==v.p)&&dblcmp(r-v.r)==0);
    }
    double area()
    {
        return pi*sqr(r);
    }
    double circumference()
    {
        return 2*pi*r;
    }
    //0 圆外
    //1 圆上
    //2 圆内
    int relation(point b)
    {
        double dst=b.distance(p);
        if (dblcmp(dst-r)<0)return 2;
        if (dblcmp(dst-r)==0)return 1;
        return 0;
    }
    int crossseg(line v)
    {
        return dblcmp(v.dispointtoseg(p)-r)<=0;
    }
    int getcircle(point a,point b,double r,circle&c1,circle&c2)
    {
        circle x(a,r),y(b,r);
        int t=x.pointcrosscircle(y,c1.p,c2.p);
        if (!t)return 0;
        c1.r=c2.r=r;
        return t;
    }
    int pointcrossline(line v,point &p1,point &p2)
    {
        if (!(*this).crossseg(v))return 0;
        point a=v.lineprog(p);
        double d=v.dispointtoline(p);
        d=sqrt(r*r-d*d);
        if (dblcmp(d)==0)
        {
            p1=a;
            p2=a;
            return 1;
        }
        p1=a.sub(v.b.sub(v.a).trunc(d));
        p2=a.add(v.b.sub(v.a).trunc(d));
        return 2;
    }
    //5 相离
    //4 外切
    //3 相交
    //2 内切
    //1 内含
    int relationcircle(circle v)
    {
        double d=p.distance(v.p);
        if (dblcmp(d-r-v.r)>0)return 5;
        if (dblcmp(d-r-v.r)==0)return 4;
        double l=fabs(r-v.r);
        if (dblcmp(d-r-v.r)<0&&dblcmp(d-l)>0)return 3;
        if (dblcmp(d-l)==0)return 2;
        if (dblcmp(d-l)<0)return 1;
    }
    int pointcrosscircle(circle v,point &p1,point &p2)
    {
        int rel=relationcircle(v);
        if (rel==1||rel==5)return 0;
        if (rel==2||rel==4)
        {
            p1=p.add(v.p.sub(p).trunc(r));
            p2=p.add(v.p.sub(p).trunc(r));
            return 1;
        }
        double d=p.distance(v.p);
        double l=(d+(sqr(r)-sqr(v.r))/d)/2;
        double h=sqrt(sqr(r)-sqr(l));
        p1=p.add(v.p.sub(p).trunc(l).add(v.p.sub(p).rotleft().trunc(h)));
        p2=p.add(v.p.sub(p).trunc(l).add(v.p.sub(p).rotright().trunc(h)));
        return 2;
    }
    void tangentline(point q,line &u,line &v)
    {
        double d=p.distance(q);
        double l=sqr(r)/d;
        double h=sqrt(sqr(r)-sqr(l));
        u=line(q,p.add(q.sub(p).trunc(l).add(q.sub(p).rotleft().trunc(h))));
        v=line(q,p.add(q.sub(p).trunc(l).add(q.sub(p).rotright().trunc(h))));
    }
    double areacircle(circle v)
    {
        int rel=relationcircle(v);
        if (rel>=4)return 0.0;
        if (rel<=2)return min(area(),v.area());
        double d=p.distance(v.p);
        double hf=(r+v.r+d)/2.0;
        double ss=2*sqrt(hf*(hf-r)*(hf-v.r)*(hf-d));
        double a1=acos((r*r+d*d-v.r*v.r)/2.0*r*d);
        a1=a1*r*r;
        double a2=acos((v.r*v.r+d*d-r*r)/2.0*v.r*d);
        a2=a2*v.r*v.r;
        return a1+a2-ss;
    }
    double areatriangle(point a,point b)
    {
        point p1,p2;
        line l(a,b);
        int t=pointcrossline(l,p1,p2);
        double angle;
        if (t<=1)
        {
            return fabs(area()*p.rad(a,b)/(2*pi));
        }
        bool b1=l.pointonseg(p1);
        bool b2=l.pointonseg(p2);
        if (b1&&b2)
        {
            return fabs(area()*p.rad(a,p1)/(2*pi)+area()*p.rad(p2,b)/(2*pi)+fabs(p1.sub(p).det(p2.sub(p)))/2.0);
        }
        if (b1)
        {
            return fabs(area()*p.rad(a,p1)/(2*pi)+fabs(p1.sub(p).det(b.sub(p))/2.0));
        }
        if (b2)
        {
            return fabs(area()*p.rad(p2,b)/(2*pi)+fabs(a.sub(p).det(p2.sub(p))/2.0));
        }
        return fabs(a.sub(p).det(b.sub(p))/2.0);
    }
    double areapologon(polygon pl)
    {
        int i,j,k,l,m;
        double ans=0;
        for (i=0;i<pl.n;i++)
        {
            int j=(i+1)%pl.n;
            if (dblcmp(pl.p[j].sub(p).det(pl.p[i].sub(p)))>=0)
            {
                ans+=areatriangle(pl.p[i],pl.p[j]);
            }
            else
            {
                ans-=areatriangle(pl.p[i],pl.p[j]);
            }
        }
        return fabs(ans);
    }
};
const int maxn=500;
struct circles
{
    circle c[maxn];
    int n;
    circles(){}
    void add(circle cc)
    {
        c[n++]=cc;
    }
    void init_or()//圆的面积并去掉内含的圆
    {
        bool v[maxn]={0};
        int i,j,k=0;
        for (i=0;i<n;i++)
        {
            for (j=0;j<n;j++)
            {
                if (i==j)continue;
                if (c[i].relationcircle(c[j])==1)v[i]=1;
            }
        }
        for (i=0;i<n;i++)
        {
            if (!v[i])c[k++]=c[i];
        }
        n=k;
    }
    void init_and()//圆的面积交去掉包含的圆
    {
        bool v[maxn]={0};
        int i,j,k=0;
        for (i=0;i<n;i++)
        {
            for (j=0;j<n;j++)
            {
                if (i==j)continue;
                if (c[j].relationcircle(c[i])==1)v[i]=1;
            }
        }
        for (i=0;i<n;i++)
        {
            if (!v[i])c[k++]=c[i];
        }
        n=k;
    }
};
struct halfplane:public line
{
    double angle;
    halfplane(){}
    halfplane(point _a,point _b)
    {
        a=_a;
        b=_b;
    }
    void calcangle()
    {
        angle=atan2(b.y-a.y,b.x-a.x);
    }
    bool operator<(const halfplane &b)const
    {
        return angle<b.angle;
    }
};
struct halfplanes
{
    int n;
    halfplane hp[maxp];
};
struct point3
{
    double x,y,z;
    point3(){}
    point3(double _x,double _y,double _z):
    x(_x),y(_y),z(_z){};
    void input()
    {
        scanf("%lf%lf%lf",&x,&y,&z);
    }
    void output()
    {
        printf("%.2lf %.2lf %.2lf",x,y,z);
    }
    bool operator==(point3 a)
    {
        return dblcmp(a.x-x)==0&&dblcmp(a.y-y)==0&&dblcmp(a.z-z)==0;
    }
    bool operator<(point3 a)const
    {
        return dblcmp(a.x-x)==0?dblcmp(y-a.y)==0?dblcmp(z-a.z)<0:y<a.y:x<a.x;
    }
    double len()
    {
        return sqrt(len2());
    }
    double len2()
    {
        return x*x+y*y+z*z;
    }
    double distance(point3 p)
    {
        return sqrt((p.x-x)*(p.x-x)+(p.y-y)*(p.y-y)+(p.z-z)*(p.z-z));
    }
    point3 add(point3 p)
    {
        return point3(x+p.x,y+p.y,z+p.z);
    }
    point3 sub(point3 p)
    {
        return point3(x-p.x,y-p.y,z-p.z);
    }
    point3 mul(double d)
    {
        return point3(x*d,y*d,z*d);
    }
    point3 div(double d)
    {
        return point3(x/d,y/d,z/d);
    }
    double dot(point3 p)
    {
        return x*p.x+y*p.y+z*p.z;
    }
    point3 det(point3 p)
    {
        return point3(y*p.z-p.y*z,p.x*z-x*p.z,x*p.y-p.x*y);
    }
    double rad(point3 a,point3 b)
    {
        point3 p=(*this);
        return acos(a.sub(p).dot(b.sub(p))/(a.distance(p)*b.distance(p)));
    }
    point3 trunc(double r)
    {
        r/=len();
        return point3(x*r,y*r,z*r);
    }
    point3 rotate(point3 o,double r)
    {
    }
};
struct line3
{
    point3 a,b;
    line3(){}
    line3(point3 _a,point3 _b)
    {
        a=_a;
        b=_b;
    }
    bool operator==(line3 v)
    {
        return (a==v.a)&&(b==v.b);
    }
    void input()
    {
        a.input();
        b.input();
    }
    double length()
    {
        return a.distance(b);
    }
    double dispointtoline(point3 p)
    {
        b.sub(a).det(p.sub(a)).len()/a.distance(b);
    }
    point3 lineprog(point3 p)
    {
        return a.add(b.sub(a).trunc(b.sub(a).dot(p.sub(a))/b.distance(a)));
    }
};
struct plane
{
    point3 a,b,c;
    plane(){}
    plane(point3 _a,point3 _b,point3 _c)
    {
        a=_a;
        b=_b;
        c=_c;
    }
    void input()
    {
        a.input();
        b.input();
        c.input();
    }
    point3 pvec()
    {
        return b.sub(a).det(c.sub(a));
    }
};
int type(int a,int b,int c)
{
    if (a==0&&b==0)
    {
        return c==0;
    }
    return 2;
}
int main()
{
    int i,j,k;
    int a1,b1,c1;
    int a2,b2,c2;
    scanf("%d%d%d%d%d%d",&a1,&b1,&c1,&a2,&b2,&c2);
    j=type(a1,b1,c1);
    k=type(a2,b2,c2);
    if (j==0||k==0)
    {
        puts("0");
        return 0;
    }
    if (j==1||k==1)
    {
        puts("-1");
        return 0;
    }
    line l1=line(a1*1.0,b1*1.0,c1*1.0);
    line l2=line(a2*1.0,b2*1.0,c2*1.0);
    int t=l1.linecrossline(l2);
    if (t==0)
    {
        puts("0");
        return 0;
    }
    if (t==1)
    {
        puts("-1");
        return 0;
    }
    puts("1");
    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <list>
#include <fstream>
#define ull unsigned long long
#define ll long long
#define ld long double
#define pi 3.1415926536
#define lp(i,n,a) for(ll i=a;i<=n;i++)
#define pl(i,n) for(ll i=n-1;i>=0;i--)
#define w while
#define re return
using namespace std;
int a,b,c,x,y,z,cnt;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    cin>>a>>b>>c;
    cin>>x>>y>>z;
    if((!a&&!b&&c)||(!x&&!y&&z)){cout<<"0\n";re 0;}
    if(a*y==x*b&&x*c==z*a&&b*z==y*c){cout<<"-1\n";re 0;}
    if(a*y==x*b){cout<<"0\n";re 0;}
    cout<<"1\n";
	re 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>
#include <numeric>
#include <cfloat>
#include <climits>

using namespace std;
typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-6)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define REP(i, n) rep (i, n)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define min3(a,b,c) min((a),min((b),(c)))
#define min4(a,b,c,d) min((a),min3((b),(c),(d)))
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FLL(a,b) memset((a),b,sizeof(a))
#define CLR(a) memset((a),0,sizeof(a))
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
#define FORR(it,a) for(__typeof(a.rbegin())it=a.rbegin();it!=a.rend();++it)

template<typename T,typename U> ostream& operator<< (ostream& out, const pair<T,U>& val){return out << "(" << val.F << ", " << val.S << ")";}
template<class T> ostream& operator<< (ostream& out, const vector<T>& val){out << "{";rep(i,SZ(val)) out << (i?", ":"") << val[i];return out << "}";}
typedef double FP;
typedef complex<FP> pt;
typedef pt P;
typedef pair<pt,pt> line;
namespace std{
  bool operator<(const P&a,const P&b){
    if(abs(a.real()-b.real())>EPS)
      return a.real()<b.real();
    return a.imag()<b.imag();
  }
}
FP dot(P a,P b){return real(conj(a)*b);}
FP crs(P a,P b){return imag(conj(a)*b);}
P ortho(P a){return P(imag(a),-real(a));}
P ortho(line a){return ortho(a.S-a.F);}
P crspt(P a,P b,P c,P d){b-=a,d-=c;return a+b*crs(d,c-a)/crs(d,b);}
P crspt(line a,line b){return crspt(a.F,a.S,b.F,b.S);}
bool onl(P a1,P a2,P b){return abs(b-a1)+abs(b-a2)<abs(a1-a2)+EPS;}
bool onl(line a,P b){return onl(a.F,a.S,b);}
bool iscrs(line a,line b){P c=crspt(a,b);return onl(a,c)&&onl(b,c);}
void pkuassert(bool t){t=1/t;};
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};
enum{TOP,BTM,LFT,RGT,FRT,BCK};
int dxdy2ce[]={RGT,FRT,LFT,BCK};
int s2i(string& a){stringstream ss(a);int r;ss>>r;return r;}
template<class T> T shift(T a,int b,int c,int d,int e){
  __typeof(a[0])t=a[b];
  a[b]=a[c];a[c]=a[d];a[d]=a[e];a[e]=t;return a;}
template<class T> T rgt(T a){return shift(a,TOP,LFT,BTM,RGT);}
template<class T> T lft(T a){return shift(a,TOP,RGT,BTM,LFT);}
template<class T> T frt(T a){return shift(a,TOP,BCK,BTM,FRT);}
template<class T> T bck(T a){return shift(a,TOP,FRT,BTM,BCK);}
line mkl(P a,P v){return line(a,a+v);}
FP lpdist(line a,P b){return abs(b-crspt(a,mkl(b,ortho(a))));}
FP spdist(line a,P b){
  P c(crspt(a,mkl(b,ortho(a))));
  return onl(a,c)?abs(b-c):min(abs(a.F-b),abs(a.S-b));
}
FP ssdist(line a,line b){
  return
    iscrs(a,b)?0.:
    min4(spdist(a,b.F),spdist(a,b.S),
         spdist(b,a.F),spdist(b,a.S));
}

void norm(int &a,int &b,int &c){
  int g=1;
  if(a)
    g = abs(a);
  else if(b) g = abs(b);
  else if(c) g = abs(c);

  if(b)
    g = __gcd(g,abs(b));
  if(c)
    g = __gcd(g,abs(c));

  a /= g;
  b /= g;
  c /= g;
  if(make_pair(a,mp(b,c)) >
     make_pair(-a,mp(-b,-c))){
    a = -a;
    b = -b;
    c = -c;
  }
}

int main(int argc, char *argv[])
{
  int a1,b1,c1;
  int a2,b2,c2;
  cin >> a1 >> b1 >> c1;
  cin >> a2 >> b2 >> c2;

  if(a1 == 0 && b1 == 0 && c1){
    cout << 0 << endl;
    return 0;
  }

  if(a2 == 0 && b2 == 0 && c2){
    cout << 0 << endl;
    return 0;
  }

  if(a1 == 0 && b1 == 0 && c1 == 0){
    cout << -1 << endl;
    return 0;
  }

  if(a2 == 0 && b2 == 0 && c2 == 0){
    cout << -1 << endl;
    return 0;
  }

  if(a1*b2 == a2*b1){
    norm(a1,b1,c1);
    norm(a2,b2,c2);
    if(a1 == a2 && b1==b2 && c1==c2)
      cout << -1 << endl;
    else
      cout << 0 << endl;
    return 0;
  }

  cout << 1 << endl;

  return 0;
}

#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    if (a > d)
    {
        swap(a, d);
        swap(b, e);
        swap(c, f);
    }
    if (a == 0 && b == 0 && c != 0)
    {
        cout << "0";
        return 0;
    }
    if (d == 0 && e == 0 && f != 0)
    {
        cout << "0";
        return 0;
    }
    if (a == 0 && b == 0 && c == 0)
    {
        cout << "-1";
        return 0;
    }
    if (d == 0 && e == 0 && f == 0)
    {
        cout << "-1";
        return 0;
    }
    int D;
    if (a != 0)
        D = d / a;
    if (b != 0)
        D = e / b;
    if (c != 0)
        D = f / c;
    if (a * D == d && b * D == e && c * D == f)
        cout << "-1";
    else
    {
        if (a * e == b * d)
            cout << "0";
        else
            cout << "1";
    }
    return 0;
}

#include<cstdio>
using namespace std;
int main(){
	int a,b,c,a1,b1,c1;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&a1,&b1,&c1);
	if(a*b1!=a1*b)puts("1");
	else if((!a&&!b&&c)||(!a1&&!b1&&c1))puts("0");
	else if(a*b1==a1*b){
		if(a*c1==a1*c&&b*c1==c*b1)puts("-1");
		else puts("0");
	}
	return 0;
}

#ifdef __GNUC__
#pragma GCC target("sse4,avx")
#endif
#include <immintrin.h>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <cstdint>
#include <numeric>

void run(std::istream &in, std::ostream &out) {
  int a1, b1, c1;
  int a2, b2, c2;
  in >> a1 >> b1 >> c1;
  in >> a2 >> b2 >> c2;
  if (a1 == 0 && b1 == 0 && c1 != 0) {
    out << "0" << std::endl;
    return;
  }
  if (a2 == 0 && b2 == 0 && c2 != 0) {
    out << "0" << std::endl;
    return;
  }
  if (a1 == 0 && b1 == 0 && c1 == 0) {
    out << "-1" << std::endl;
    return;
  }
  if (a2 == 0 && b2 == 0 && c2 == 0) {
    out << "-1" << std::endl;
    return;
  }
  if (a1 * b2 == b1 * a2) {
    if (a1 * c2 == a2 * c1 && b1 * c2 == b2 * c1) {
      out << "-1" << std::endl;
    } else {
      out << "0" << std::endl;
    }
  } else {
    out << "1" << std::endl;
  }
}

int main() {
  std::cin.sync_with_stdio(false);
  std::cin.tie(nullptr);
  run(std::cin, std::cout);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main ()
{
	std::ios_base::sync_with_stdio (0);
	std::cin.tie (0);
	int a1, b1, c1, a2, b2, c2;
	cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
	if (a1*b2 - a2 * b1) {
		cout << 1 << endl;
	}
	else if ((!a1 && !b1 && c1) || (!a2 && !b2 && c2) || (c1*b2 - c2 * b1) || (a1*c2 - a2 * c1)) {
		cout << 0 << endl;
	}
	else {
		cout << -1 << endl;
	}
}

/**********************************************
			Author : smiley007
***********************************************/

//Data Structure Includes
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <list>
#include <set>
#include <map>

//Other Includes
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <ctime>
#include <sstream>
#include <climits>

using namespace std;

//Defines
#define FOR(i,a,b)         	for(int i = (a); i <  (b) ; i++)
#define FOE(i,a,b)         	for(int i = (a); i <= (b) ; i++)
#define FOED(i,a,b)			for(int i = (a); i >= (b) ; i--)
#define ITR(v,it) 			for( typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define REP(i,n)			FOR(i,0,n)
#define ALL(a) 				a.begin(),a.end()
#define SORT(a) 			sort(ALL(a))
#define SZ(a)				((int)a.size())
#define BS(i) 				__builtin_popcount(i)
#define LZ(i)				__clz
#define RE 					return
#define FI 					first
#define SD 					second
#define P 					printf
#define S 					scanf
#define PB					push_back
#define MP(x,y)				make_pair(x,y)
#define SET(a,v)			memset(a,v, sizeof(a[0])*SZ(a) )
#define EPS					1e-9
#define INF					1e9
#define PI 					3.141592653589793
#define MOD 				1000000007

//Typedefs
typedef char C ;
typedef int I ;
typedef long L ;
typedef double D ;
typedef long long LL ;
typedef vector<int> VI ;
typedef vector<string> VS ;
typedef vector<string,string> VSS ;
typedef vector<VI> VVI ;
typedef pair<int,int> PII ;
typedef vector<PII> VPII ;

//Templates
template<class T> T toDec(string s){stringstream is(s);T res;is>>res;RE res;} //toDec
template<class T> string toStr(T n){string s;stringstream is;is<<n;is>>s;RE s;} //toStr
template<class T> bool isPrime(T x){if(x<=1)RE false;T i;for(i=2;i*i<=x;i++)if(x%i==0)RE false;RE true;} //isPrime
template<class T> D dist(T x1,T y1,T x2,T y2){RE sqrt( 1.*(x2-x1)*(x2-x1) + 1.*(y2-y1)*(y2-y1) ) ;} //dist
template<class T> class Prime{public:vector<T> z ;Prime(){z.resize(1e5+7);REP(i,SZ(z)) z[i]=1;
z[0]=0;z[1]=0;T j;FOR(i,2,SZ(z)){if(z[i]){j=i+i;while(j<SZ(z)){ z[j]=0;j += i ;} } }} }; //Prime

I main(){
	#ifdef LocalHost
		freopen("input.txt","r",stdin);
	#endif

	I a1,b1,c1,a2,b2,c2 ;
	cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2 ;
	if(a1==0 && b1==0 && c1!=0) cout <<0; else
	if(a2==0 && b2==0 && c2!=0) cout <<0; else
	if(a1==0 && b1==0) cout <<-1; else
	if(a2==0 && b2==0) cout <<-1; else
	if(a1*b2 != a2*b1) cout << 1; else
	if(c1*b2 == c2*b1 && a1*c2 == a2*c1  ) cout << -1;else
	cout << 0;

	#ifdef LocalHost
    cout<<endl<<"Execution time = "<<(float)clock()/CLOCKS_PER_SEC <<" s"<<endl;
	#endif

	RE 0;
}

#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int main() {
    int a1, b1, c1;
    scanf("%d %d %d", &a1, &b1, &c1);
    int a2, b2, c2;
    scanf("%d %d %d", &a2, &b2, &c2);
    if(a1 == 0 && b1 == 0 && a2 == 0 && b2 == 0) {
        if(c1 == 0 && c2 == 0) { printf("-1\n"); }
        else { printf("0\n"); }
    }
    else if(a1*b2 != a2*b1) { printf("1\n"); }
    else {
        if(a1*c2 == a2*c1 && b1*c2 == b2*c1) { printf("-1\n"); }
        else printf("0\n");
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double a1,b1,c1,a2,b2,c2;
    while(cin>>a1>>b1>>c1>>a2>>b2>>c2)
    {
        if(!a1&&!b1&&c1||!a2&&!b2&&c2)///其中一条直线不存在，没有交点
            puts("0");
        else if(a1*b2==a2*b1) ///直线斜率相等
        {
            if(!b1&&!b2)
                printf("%d\n",a1*c2==a2*c1?-1:0);///平行y轴情况
            else
                printf("%d\n",b1*c2==c1*b2?-1:0);///平行x轴情况
        }
        else puts("1");          ///相交有1个交点
    }
    return 0;
}

#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cassert>
#include <iomanip>
#include <cmath>
using namespace std;
#define pb push_back
#define mp make_pair
int main()
{
    int a1,b1,c1,a2,b2,c2;
    cin>>a1>>b1>>c1>>a2>>b2>>c2;
    if(a1==0&&b1==0&&c1==0&&a2==0&&b2==0&&c2!=0)
    {
        cout<<0;
        return 0;
    }
    if(a2==0&&b2==0&&c2==0&&a1==0&&b1==0&&c1!=0)
    {
        cout<<0;
        return 0;
    }
    if(a1==0&&b1==0&&c1==0)
    {
        cout<<-1;
        return 0;
    }
    if(a2==0&&b2==0&&c2==0)
    {
        cout<<-1;
        return 0;
    }
    if(a1==0&&b1==0)
    {
        cout<<0;
        return 0;
    }
    if(a2==0&&b2==0)
    {
        cout<<0;
        return 0;
    }
    if(a1==0&&a2!=0)
    {
        cout<<1;
        return 0;
    }
    if(a1==0&&a2==0&&c2==0)
    {
        cout<<0;
        return 0;
    }
    if(a1==0&&b1==0&&b2==0)
    {
        if(c1==c2)
            cout<<-1;
        else
            cout<<0;
        return 0;
    }
    if(a1==0&&a2==0&&(double)c1/b1==(double)c2/b2)
    {
        cout<<-1;
        return 0;
    }
    if(a1==0&&a2==0&&(double)c1/b1!=(double)c2/b2)
    {
        cout<<0;
        return 0;
    }
    if((double)b1/a1==(double)b2/a2&&(double)c1/a1==(double)c2/a2)
        cout<<-1;
    else
    {
        if((double)b1/a1==(double)b2/a2)
            cout<<0;
        else
            cout<<1;
    }
	return 0;
}

#include <bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<algorithm>

using namespace std;

int main()
{
    int A1, B1, C1, A2, B2, C2;

    cin >> A1 >> B1 >> C1 >> A2 >> B2 >> C2;

    if(A1==0 && A2==0 && B1==0 && B2==0)
    {
        if(C1==0&&C2==0)
            cout<<-1;
        else
            cout<<0;
        return 0;
    }

    if(A1==A2 && B1==B2)
    {
        if(C1 == C2)
            cout<<-1;
        else
            cout<<0;
        return 0;
    }

    if(A1*B2 == A2*B1)
    {
        if(A1*C2 == A2*C1 && B1*C2 == B2*C1) cout << "-1";
        else cout << "0";
    }
    else
    {
        cout << "1";
    }

    return 0;
}

#include<iostream>
#include<memory.h>

using namespace std;

int arr[100001];
int cnt[100001];

int main()
{
    int a,b,c;
    int A,B,C;
    cin>>a>>b>>c>>A>>B>>C;
    if ((a == 0 && b == 0 && c!=0) || (A == 0 && B == 0 && C!=0))
        cout<<0<<endl;
    else if ( b*C == B*c && A*c == a*C && a*B == A*b)
        cout<<-1<<endl;
    else if ( (b*C != B*c || A*c != a*C) && a*B == A*b)
        cout<<0<<endl;
    else
        cout<<1<<endl;

    return 0;
}

#include <bits/stdc++.h>

long GetDelta(long x11, long x12, long x21, long x22)
{
	return x11 * x22 - x12 * x21;
}

int main()
{
	std::ios_base::sync_with_stdio(0);

	long A1, B1, C1, A2, B2, C2;
	std::cin >> A1 >> B1 >> C1 >> A2 >> B2 >> C2;

	C1 *= (-1);
	C2 *= (-1);

	long delta = GetDelta(A1, B1, A2, B2),
	     deltaX = GetDelta(C1, B1, C2, B2),
	     deltaY = GetDelta(A1, C1, A2, C2);

	if(A1 == 0 && B1 == 0 && C1 != 0)
	{
		std::cout << 0 << std::endl;
	}
	else if(A2 == 0 && B2 == 0 && C2 != 0)
	{
		std::cout << 0 << std::endl;
	}
	else if(delta == 0 && deltaX == 0 && deltaY == 0)
	{
		std::cout << -1 << std::endl;
	}
	else if(delta != 0)
	{
		std::cout << 1 << std::endl;
	}
	else
	{
		std::cout << 0 << std::endl;
	}

	return 0;
}

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <memory.h>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
const double eps = 1e-8;
const double PI = acos((long double)-1.0);
const int INF = 1<<30;
const LL LINF = 1ll<<61;

#define pb push_back
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define CLR(a, v) memset((a),(v),sizeof(a))
#define sqr(a) ((a)*(a))
const int BUFFER_SZ = 1<<20;
const int MOD = 1000*1000*1000+7;

char BUFFER[BUFFER_SZ];
int gi() { int x; scanf("%d", &x); return x; }
double gd() { double x; scanf("%lf", &x); return x; }
LL gll() { LL x; cin >> x; return x; }
VI gvi(int n) { VI a; while(n-->0) a.pb(gi()); return a;}
string gs() { scanf("%s", BUFFER); return string(BUFFER); }
template <class T> void print(vector<T> &x, string format) { format += "%c";for (int i = 0; i < x.size(); ++i) printf(format.c_str(), x[i], i+1==x.size() ? '\n' : ' '); }
// ---------------------------------------------------------- //

int gcd(int a, int b) {
  return !a?b:gcd(b%a,a);
}

void solve() {
  int A1 = gi();
  int B1 = gi();
  int C1 = gi();
  int A2 = gi();
  int B2 = gi();
  int C2 = gi();

  if (!A1 && !B1 || !A2 && !B2) {
    if (!A1 && !B1 && !A2 && !B2) {
      if (C1 == 0 && C2 == 0) printf("-1\n");
      else printf("0\n");
    } else {
      if (!A1 && !B1 && C1==0) printf("-1\n");
      else if (!A2 && !B2 && C2==0) printf("-1\n");
      else printf("0\n");
    }
  } else {
    int det = A1 * B2 - A2 * B1;
    if (det == 0) {
      int x,y;
      int d1 = gcd(abs(A1),abs(B1)); d1 = gcd(d1,abs(C1));
      A1/=d1; B1/=d1; C1/=d1;
      if (A1<0 || A1==0 && B1<0) A1*=-1,B1*=-1,C1*=-1;

      int d2 = gcd(abs(A2),abs(B2)); d2 = gcd(d2,abs(C2));
      A2/=d2; B2/=d2; C2/=d2;
      if (A2<0 || A2==0 && B2<0) A2*=-1,B2*=-1,C2*=-1;

      if (A1==A2 && B1==B2 && C1==C2) {
        printf("-1\n");
      } else {
        printf("0\n");
      }
    } else {
      printf("1\n");
    }
  }
}

int main() {
#ifdef DEAD_RABBIT
  freopen("../in.txt","r",stdin);
  clock_t start = clock();
#endif
  solve();
#ifdef DEAD_RABBIT
  fprintf(stdout, "Time: %.3lf\n", 1.0*(clock()-start)/CLOCKS_PER_SEC);
#endif
  return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	int a1, b1, c1, a2, b2, c2;
	while(scanf("%d%d%d", &a1, &b1, &c1) != EOF) {
		scanf("%d%d%d", &a2, &b2, &c2);
		if( (a1 == 0 && b1 == 0 && c1) || (a2 == 0 && b2 == 0 && c2) ) {
			printf("0\n");
			continue;
		}
		if(b1 == 0 && b2 == 0) {
			if(a1 == 0 || a2 == 0) printf("-1\n");
			else {
				double t1 = -c1*1.0/a1;
				double t2 = -c2*1.0/a2;
				if(fabs(t1-t2) <1e-12) printf("-1\n");
				else printf("0\n");
			}
			continue;
		}
		else if(b1) {
			double A = a2 - a1*b2*1.0/b1;
			double B = c2 - c1*b2*1.0/b1;
			//printf("%lf %lf\n", A, C);
			if(fabs(A)<1e-12 && fabs(B)<1e-12) printf("-1\n");
			else {
				if(fabs(A)<1e-12) printf("0\n");
				else printf("1\n");
			}
		}
		else if(b2) {
			double A = a1 - a2*b1*1.0/b2;
			double B = c1 - c2*b1*1.0/b2;
			//printf("%lf %lf\n", A, C);
			if(fabs(A)<1e-12 && fabs(B)<1e-12) printf("-1\n");
			else {
				if(fabs(A)<1e-12) printf("0\n");
				else printf("1\n");
			}
		}
	}
	return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (int) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const int inf = numeric_limits <int>::max() >> 1;
int a1, b1, c1;
int a2, b2, c2;

void input() {
    cin >> a1 >> b1 >> c1;
    cin >> a2 >> b2 >> c2;
    if(a1 < 0) {
        a1 = -a1;
        b1 = -b1;
        c1 = -c1;
    }
    if(a2 < 0) {
        a2 = -a2;
        b2 = -b2;
        c2 = -c2;
    }
}

void solve() {
    int g1 = __gcd(a1, b1);
    int g2 = __gcd(a2, b2);
    if(abs(g1) > abs(g2)) {
        swap(g1, g2);
        swap(c1, c2);
        swap(a1, a2);
        swap(b1, b2);
    }
    if(g1 == 0) {
        if(g2 == 0) {
            cout << (!c1 && !c2? "-1": "0\n");
        } else {
            cout << (!c1? "-1\n": "0\n");
        }
        return;
    }
    if(a1 * g2 == a2 * g1 && b1 * g2 == b2 * g1) {
        cout << (c1 * g2 == c2 * g1? "-1\n": "0\n");
    } else {
        cout << "1\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}

#include <stdio.h>

const int Size = 3;

int Fir[Size];
int Sec[Size];

void Read_Case()
{
	for(int i=0;i<Size;i++)scanf("%d",Fir+i);
	for(int i=0;i<Size;i++)scanf("%d",Sec+i);
}

int Judge(int *Now)
{
	if(Now[0]||Now[1])return 1;
	if(Now[2])return 2;
	return 3;
}

void Deal()
{
	if(!Fir[1]||!Sec[1])
	{
		int A=Judge(Fir);
		int B=Judge(Sec);
		if(A==2||B==2){puts("0");return;}
		if(A==3||B==3){puts("-1");return;}
		if(Fir[1]||Sec[1])puts("1");
		else if(Fir[0]*Sec[2]==Fir[2]*Sec[0])puts("-1");
		else puts("0");
	}
	else
	{
		bool A=Fir[0]*Sec[1]==Sec[0]*Fir[1];
		bool C=Fir[2]*Sec[1]==Sec[2]*Fir[1];
		if(A&&C)puts("-1");
		else if(A)puts("0");
		else puts("1");
	}
}

int main()
{
	Read_Case();
	Deal();
}

//B

#include <cstdio>
#include <cstring>

int A[2],B[2],C[2];

bool IsEmpty(int i)
{
    if(A[i]==0 && B[i]==0 && C[i]!=0)return true;
    return false;
}

bool IsFull(int i)
{
    if(A[i]==0 && B[i]==0 && C[i]==0)return true;
    return false;
}

int main()
{
    while(scanf("%d%d%d",A,B,C)==3){
        scanf("%d%d%d",A+1,B+1,C+1);

        if(IsEmpty(0) || IsEmpty(1)){
            puts("0");
            continue;
        }

        if( IsFull(0) || IsFull(1) ){
            puts("-1");
            continue;
        }

        if( A[0]*B[1] == A[1]*B[0] ){
            if(A[0]*C[1]==A[1]*C[0] && B[0]*C[1]==B[1]*C[0])puts("-1");
            else puts("0");
        }
        else{
            puts("1");
        }

    }

    return 0;
}

/* Headers */
#include<algorithm>
#include<iostream>
#include<cstring>
#include<climits>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#define FOR(i,a,b,c) for(int i=(a);i<=(b);i+=(c))
#define ROF(i,a,b,c) for(int i=(a);i>=(b);i-=(c))
#define FORL(i,a,b,c) for(long long i=(a);i<=(b);i+=(c))
#define ROFL(i,a,b,c) for(long long i=(a);i>=(b);i-=(c))
#define FORR(i,a,b,c) for(register int i=(a);i<=(b);i+=(c))
#define ROFR(i,a,b,c) for(register int i=(a);i>=(b);i-=(c))
#define lowbit(x) x&(-x)
#define LeftChild(x) x<<1
#define RightChild(x) (x<<1)+1
#define RevEdge(x) x^1
#define FILE_IN(x) freopen(x,"r",stdin);
#define FILE_OUT(x) freopen(x,"w",stdout);
#define CLOSE_IN() fclose(stdin);
#define CLOSE_OUT() fclose(stdout);
#define IOS(x) std::ios::sync_with_stdio(x)
#define Dividing() printf("-----------------------------------\n");
namespace FastIO{
    const int BUFSIZE = 1 << 20;
    char ibuf[BUFSIZE],*is = ibuf,*its = ibuf;
    char obuf[BUFSIZE],*os = obuf,*ot = obuf + BUFSIZE;
    inline char getch(){
        if(is == its)
            its = (is = ibuf)+fread(ibuf,1,BUFSIZE,stdin);
        return (is == its)?EOF:*is++;
    }
    inline int getint(){
        int res = 0,neg = 0,ch = getch();
        while(!(isdigit(ch) || ch == '-') && ch != EOF)
            ch = getch();
        if(ch == '-'){
            neg = 1;ch = getch();
        }
        while(isdigit(ch)){
            res = (res << 3) + (res << 1)+ (ch - '0');
            ch = getch();
        }
        return neg?-res:res;
    }
    inline void flush(){
        fwrite(obuf,1,os - obuf,stdout);
        os = obuf;
    }
    inline void putch(char ch){
        *os++ = ch;
        if(os == ot)	flush();
    }
    inline void putint(int res){
        static char q[10];
        if(res == 0) putch('0');
        else if(res < 0){putch('-');res = -res;}
        int top = 0;
        while(res){
            q[top++] = res % 10 + '0';
            res /= 10;
        }
        while(top--)	putch(q[top]);
    }
    inline void space(bool x){
    	if(!x) putch('\n');
    	else putch(' ');
    }
}
inline void read(int &x){
    int rt = FastIO::getint();
    x = rt;
}
inline void print(int x,bool enter){
    FastIO::putint(x);
    FastIO::flush();
    FastIO::space(enter);
}
/* definitions */
double A1, A2, B1, B2, C1, C2;
/* functions */
int main(int argc,char *argv[]){
	scanf("%lf %lf %lf %lf %lf %lf", &A1, &B1, &C1, &A2, &B2, &C2);
	if(!B1 && !B2) {
		if((!A1 && C1) || (!A1 && C2)) return puts("0") & 0;
		if((!C1 && !C2) || (!A1 && !A2) || C1 / A1 == C2 / A2) return puts("-1") & 0;
		else return puts("0") & 0;
	}
	else if((!B1 && !A1 && !C1) || (!B2 && !A2 && !C2)) return puts("-1") & 0;
	else if((!B1 && !A1) || (!B2 && !A2)) return puts("0") & 0;
	else if(!B1 || !B2) return puts("1") & 0;
	if(A1 / B1 == A2 / B2 && C1 / B1 == C2 / B2) return puts("-1") & 0;
	else if(A1 / B1 == A2 / B2) return puts("0") & 0;
	else return puts("1") & 0;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define pi acos(-1)
#define P pair<int,int>
#define fi first
#define se second
#define si signed
#define sc(x) scanf("%lld",&(x));
string s;

bool check(int i)
{

    if(s[i]=='_')return true;
    else
    {
        for(int j=0; j<26; j++)
        {
            if(s[i]=='a'+j||s[i]=='A'+j)
            {
                return true;
            }
        }

        for(int j=0; j<10; j++)
        {
            if(s[i]==j+'0')
            {
                return true;
            }
        }
        return false;
    }

}

signed main()
{
    int a1,a2,b1,b2,c1,c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;
    if((a1==0&&b1==0&&c1)||(a2==0&&b2==0&&c2)){
        cout<<0<<endl;

    }
    else if((a1==0&&b1==0&&c1==0)||(a2==0&&b2==0&&c2==0)){
        cout<<-1<<endl;
    }

    else if(a1*b2==a2*b1){
        if(c1*b2==c2*b1&&a1*c2==a2*c1){
            cout<<-1<<'\n';
        }else cout<<0<<'\n';
    }else{
       cout<<1<<'\n';
    }
}

#include <bits/stdc++.h>

#define ll          long long
#define ld          long double
#define pb          push_back
#define pf          push_front
#define mp          make_pair
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define vll         vector<pll>
#define ml          map<ll,ll>
#define mll         map<pll,ll>
#define all(a)      a.begin(),a.end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define mod         1000000007
#define lp(i,a,b)   for(ll i=a;i<b;++i)
#define lpr(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
int a1, b1, c1;
int a2, b2, c2;
int d;

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int main(){
    ios
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
    if (a1 == 0 && b1 == 0 && c1 || a2 == 0 && b2 == 0 && c2) return printf("0"), 0;
    if (a1 == 0 && b1 == 0 || a2 == 0 && b2 == 0) return printf("-1"), 0;
    if (a1 == 0 && b2 == 0 || a2 == 0 && b1 == 0) return printf("1"), 0;
    if (a1 == 0 && a2 == 0) return printf("%d", (c1 * b2 != c2 * b1) - 1), 0;
    if (b1 == 0 && b2 == 0) return printf("%d", (c1 * a2 != c2 * a1) - 1), 0;
    if (b1 < 0) a1 = -a1, b1 = -b1, c1 = -c1;
    if (b2 < 0) a2 = -a2, b2 = -b2, c2 = -c2;
    d = gcd(abs(a1), gcd(abs(c1), b1));
    a1 /= d, b1 /= d, c1 /= d;
    d = gcd(abs(a2), gcd(abs(c2), b2));
    a2 /= d, b2 /= d, c2 /= d;
    if (a1 * b2 == a2 * b1) return printf("%d", (c1 * a2 != c2 * a1) - 1), 0;
    printf("1");
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;

int gcd(int a, int b)
{return b? gcd(b, a%b): a;}

int ex(int a, int b, int c)
{if (a==0 && b==0 && c!=0) return 1; else return 0;}

int all(int a, int b, int c)
{if (a==0 && b==0 && c==0) return 1; else return 0;}

void norm(int *a, int *b, int *c)
{
    int g;
    if (!(*b))
    {
        g=gcd(abs(*a), abs(*c));
        *a/=g; *c/=g;
    }
    else if (!(*a))
    {
        g=gcd(abs(*b), abs(*c));
        *b/=g; *c/=g;
    }
    else
    {
        g=gcd(abs(*a), abs(*b));
        g=gcd(g, abs(*c));
        *a/=g; *b/=g; *c/=g;
    }
    if (*a<0) {*a=-*a; *b=-*b; *c=-*c;}
    if (*a==0 && *b<0) {*a=-*a; *b=-*b; *c=-*c;}
}

int main()
{

    int a1, b1, c1, a2, b2, c2;
    scanf("%d %d %d %d %d %d", &a1, &b1, &c1, &a2, &b2, &c2);
    if (ex(a1, b1, c1) || ex(a2, b2, c2)) {printf("0"); return 0;}
    if (all(a1, b1, c1) || all(a2, b2, c2)) {printf("-1"); return 0;}
    if (a1*b2!=a2*b1) {printf("1"); return 0;}
    norm(&a1, &b1, &c1); norm(&a2, &b2, &c2);
    if (a1==a2 && b1==b2 && c1==c2) {printf("-1"); return 0;}
    printf("0");
}

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>

#define pb push_back
#define mp make_pair
#define PI 3.14159265358979
#define sqr(x) (x)*(x)
#define forn(i, n) for(int i = 0; i < n; ++i)
#define ALL(x) x.begin(), x.end()
#define max(a,b) ((a>b)?(a):(b))
#define min(a,b) ((a<b)?(a):(b))
#define sz(x) int((x).size())
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<int,int> pii;
const int INF = 2147483647;
const ll LLINF = 9223372036854775807;

int gres(int a, int b, int c) {
	if (a==0&&b==0) {
		if (c==0) return -2;
		else return 0;
	} else return 1;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a1, a2, b1, b2, c1, c2; cin>>a1>>b1>>c1>>a2>>b2>>c2;
	int res = 0;
	int r = gres(a1,b1,c1) * gres(a2,b2,c2);
	switch(r) {
		case 0: res = 0; break;
		case -2: res = -1; break;
		case 4: res = -1; break;
		case 1:
			if (a1*b2==a2*b1) {
				if (c1*b2==c2*b1&&c1*a2==c2*a1) res = -1;
				else res = 0;
			} else res = 1;
	}
	cout << res;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int ui;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int a[2], b[2], c[2];
	for(int i=0; i<2; i++)
		cin >> a[i] >> b[i] >> c[i];
	for(int i=0; i<2; i++)
		if( !a[i] && !b[i] && c[i] )
		{
			cout << 0;
			return 0;
		}
	if( a[0] * b[1] == a[1] * b[0] )
	{
		if( a[0] * c[1] == a[1] * c[0] && b[0] * c[1] == b[1] * c[0] )
			cout << -1;
		else
			cout << 0;
	}
	else
		cout << 1;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <complex>
#include <cmath>
#define rep(i,n) for(int i=0; i<n; ++i)
#define mp make_pair
#define p pair<int,int>
using namespace std;
int gcd(int a, int b) {
	if (a < b) swap(a, b);
	if (!b) return a;
	return gcd(b, a%b);
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int a1, b1, c1, a2, b2, c2;
	cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
	if (a1 == 0 && b1 == 0) {
		if (c1 != 0 || (a2 == 0 && b2 == 0 && c2 != 0)) cout << 0;
		else cout << -1;
		return 0;
	}
	if (a2 == 0 && b2 == 0) {
		if (c2 != 0 || (a1 == 0 && b1 == 0 && c1 != 0)) cout << 0;
		else cout << -1;
		return 0;
	}
	int gcd1 = gcd(gcd(abs(a1), abs(b1)), abs(c1)),
		gcd2 = gcd(gcd(abs(a2), abs(b2)), abs(c2));
	a1 /= gcd1; b1 /= gcd1; c1 /= gcd1;
	a2 /= gcd2; b2 /= gcd2; c2 /= gcd2;
	if ((a1 == a2 && b1 == b2 && c1 == c2) ||
		(a1 + a2 == 0 && b1 + b2 == 0  && c1 +c2==0)) cout << -1;
	else if (a1*b2 == a2*b1) cout << 0;
	else cout << 1;
}

// Thu Nov 24 2016 20:20:08 GMT+0300 (MSK)

# include <iostream>
# include <math.h>
# include <fstream>
# include <vector>
# include <algorithm>
# include <string>
using namespace std;
//printf ("%.8lf\n", a);
// erase

# define all(a) a.begin(), a.end()
# define Sort(a) sort(all(a));
# define pause system("pause");
# define ll long long
# define VI vector <int>
# define pb push_back

int prob(int a1, int b1, int c1, int a2, int b2, int c2)
{
    if(a1==0&&b1==0&&c1!=0) return 0;
    if(a2==0&&b2==0&&c2!=0) return 0;

    if(a1==0&&b1==0) return -1;
    if(a2==0&&b2==0) return -1;

    if(a1*b2==b1*a2&&a1*c2==a2*c1&&b1*c2==b2*c1) return -1;
    if(a1*b2==b1*a2) return 0;

    return 1;
}

int main()
{
    int a1, b1, c1, a2, b2, c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;

    cout<<prob(a1,b1,c1,a2,b2,c2)<<endl;
    //pause;

}

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <iterator>
#include <cmath>
#include <deque>
using namespace std;

int gcd(int a, int b)
{
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}

int main()
{
    if (fopen("input.txt", "r")) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
    int f = 0;
    if (a1 == 0 && b1 == 0) {
        if (c1 != 0) {
            cout << 0;
            return 0;
        }
        f = -1;
    }
    if (a2 == 0 && b2 == 0) {
        if (c2 != 0) {
            cout << 0;
            return 0;
        }
        f = -1;
    }
    if (f < 0) {
        cout << -1;
        return 0;
    }
    if (a1 < 0 || a1 == 0 && b1 < 0) {
        a1 = -a1;
        b1 = -b1;
        c1 = -c1;
    }
    if (a2 < 0 || a2 == 0 && b2 < 0) {
        a2 = -a2;
        b2 = -b2;
        c2 = -c2;
    }
    int g1 = gcd(a1, abs(b1));
    int g2 = gcd(a2, abs(b2));
    a1 /= g1;
    b1 /= g1;
    a2 /= g2;
    b2 /= g2;
    if (a1 == a2 && b1 == b2) {
        if (c1 * g2 == c2 * g1)
            cout << -1;
        else
            cout << 0;
    }
    else {
        cout << 1;
    }
    return 0;
}

#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <bitset>
#include <string>
#include <vector>
#include <algorithm>
#include <ctime>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <sstream>
#include <cmath>
#include <fstream>
#include <list>
using namespace std;
#define rp(i,n) for(int (i)=0;(i)<(n);++(i))
#define pb push_back
#define L(s) (int)s.size()
#define mp make_pair
#define pii pair<int,int>
//#define x first
#define y second
#define inf 1000000000
#define VI vector<int>
#define ll long long
#define all(s) (s).begin(),(s).end()
#define C(u) memset((u),0,sizeof((u)))
#define ull unsigned ll
int a1,b1,c1,a2,b2,c2;
int main()
{
	cin>>a1>>b1>>c1;
	cin>>a2>>b2>>c2;
	if (!a1&&!b1&&!c1)
	{
		if (!a2&&!b2)
		{
			if (c2)
				cout<<"0\n";
			else
				cout<<"-1\n";
		}
		else
			cout<<"-1\n";
	}
	else
		if (!a1&&!b1)
			cout<<"0\n";
		else
			if (!a2&&!b2&&!c2)
				cout<<"-1\n";
			else
				if (!a2&&!b2)
					cout<<"0\n";
				else
					if (a1*b2==b1*a2)
					{
						if (a1*c2==c1*a2)
							cout<<"-1\n";
						else
							cout<<"0\n";
					}
					else
						cout<<"1\n";
}

#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    ios::sync_with_stdio(true);
    int a,b,c,a1,b1,c1,x,y,z;

    cin>>a>>b>>c;
    cin>>a1>>b1>>c1;

     if(a*b1!=a1*b) cout<<1;
     else if(a1==0&&b1==0&&c1!=0||(b==0&&a==0&&c!=0))cout<<0;
     else
     {
         if(a*b1==a1*b)
         {
             if(a*c1==a1*c&&b*c1==c*b1) cout<<-1;
             else cout<<0;
         }
     }

    return 0;
}

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<map>
#include<queue>
#include<stack>
#include<utility>
#include<cstdlib>
#include<string>
#include<set>
#include<list>
#include<limits>
#include<iomanip>
#include<fstream>
#include<sstream>
#define LLD int
#define clr(a) memset(a,0,sizeof(a))
#define reset(a) memset(a,-1,sizeof(a))
#define BD(i, j) (i >= 0 && i < N && j >= 0 && j < M)
#define PRINT_VAR(X) (cout << #X << " -> " << X << endl)
#define PI acos(0)
#define EPS 1E-8
#define INF 10000000000000LL
#define MAX_INT 2147483647
#define SIZE 20005
#define MOD 1000000007

using namespace std;
int M, N;

int main()
{
    int tc, t, x, y, z, d, q;
    int i, j, k, l, h, n, m;
    char ch; double P;

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int a1, b1, c1;
    int a2, b2, c2;

    cin >> a1 >> b1 >> c1;
    cin >> a2 >> b2 >> c2;

    if ((!a1 && !b1 && c1) || (!a2 && !b2 && c2)) {
        cout << 0 << endl;
        return 0;
    }

    if (a1*b2 == b1*a2) {
        if (a1*c2 == a2*c1 && b1*c2 == b2*c1)
            cout << -1 << endl;
        else
            cout << 0 << endl;
    }
    else
        cout << 1 << endl;

    return 0;
}

#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;

void solve(){
	int a[2],b[2],c[3];
	cin>>a[0]>>b[0]>>c[0];
	cin>>a[1]>>b[1]>>c[1];
	if(a[0]*b[1]==b[0]*a[1]){
		if(a[1]*c[0]==a[0]*c[1] && b[1]*c[0]==b[0]*c[1])cout<<-1;
		else cout<<0;
		return;
	}
	cout<<1;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
    float a1,b1,c1,a2,b2,c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;
    if(a1*b2==a2*b1)
     cout<<"-1";
    else
     cout<<"1";
}

# include <iostream>
# include <math.h>
# include <fstream>
# include <vector>
# include <algorithm>
# include <string>
using namespace std;
//printf ("%.8lf\n", a);
// erase

# define all(a) a.begin(), a.end()
# define Sort(a) sort(all(a));
# define pause system("pause");
# define ll long long
# define VI vector <int>
# define pb push_back

int prob(int a1, int b1, int c1, int a2, int b2, int c2)
{
    if(a1==0&&b1==0&&c1!=0) return 0;
    if(a2==0&&b2==0&&c2!=0) return 0;

    if(a1==0&&b1==0) return -1;
    if(a2==0&&b2==0) return -1;

    if(a1*b2==b1*a2&&a1*c2==a2*c1&&b1*c2==b2*c1) return -1;

    return 1;
}

int main()
{
    int a1, b1, c1, a2, b2, c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;

    cout<<prob(a1,b1,c1,a2,b2,c2)<<endl;
    //pause;

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
    if (a1 * b2 - b1 * a2 == 0)
        (c1 * b2 - b1 * c2 == 0) ? (cout << -1) : (cout << 0);
    else
        cout << 1;
    return 0;
}

#include<bits/stdc++.h>

#define faster     ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define read       freopen("input.txt", "r", stdin);
#define write      freopen("output.txt", "w", stdout);
#define endd        '\n'
#define ll         long long
#define sq(a)      ((a) * (a))

using namespace std;
int main()
{
      faster;
      double n,m,i,j,k,a,b,c,p,q,r,x,y,z,count=0;
      cin>>a>>b>>c>>p>>q>>r;
      //cout<<x<<" "<<y<<" "<<z;
      if((a==0 && b==0 && c!=0)||(p==0 && q==0 && r!=0))cout<<"0";
      else if(a*q==b*p){
            if(b*r==q*c)cout<<"-1";
            else cout<<"0";
      }
      else cout<<"1";
      return 0;
}
//Tafsir Rahman

#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<queue>
#include<set>
#include<string>
#include<cstdio>
#include<sstream>
#include<cctype>
#include<stack>
using namespace std;
set<int >se;
map<int,int>mp1;
map<int ,int>mp2;
vector<double>v;

int main()
{
 double a,b,c,x,y,z,n,m,q=0;
 cin>>a>>b>>c;
 cin>>x>>y>>z;
 if(a==0)
	 q++;
 if(b==0)
	 q++;
 if(x==0)
	 q++;
 if(y==0)
	 q++;
 if(a==0 && b==0 && x==0 && y==0)
 {
	 if(z==c)
 cout<<-1<<endl;
	 else
		 cout<<0<<endl;
 return 0;
 }

 if((x==0 && y==0 && z!=0) || (a==0 && b==0 && c!=0))
 {
 cout<<0<<endl;
 return 0;
 }

 if((x==0 && y==0 && z==0) || (a==0 && b==0 && c==0))
 {
 cout<<-1<<endl;
 return 0;
 }
 if((x==0 && y!=0 && a!=0 && b==0 )||(x!=0 && y==0 && a==0 && b!=0 ) )
 {
 cout<<1<<endl;
 return 0;

 }

 if(x==0 && a==0 && y!=0 && b!=0 || x!=0 && a!=0 && y==0 && b==0)
 {
 if(x*b==a*y)
 {
 if(x*c==z*a && y*c==z*b)
 {
 cout<<-1<<endl;

 }
 else
	 cout<<0<<endl;
 }
 else
	 cout<<-1<<endl;
 return 0;
 }

 if(q==1 )
 {
 cout<<1<<endl;
 return 0;
 }
 if(q==3)
 {
 cout<<0<<endl;
 return 0;
 }

 x=-1*x;
 x/=y;
 z=z*-1;

 z/=y;

 n=a+x*b;
 m=c+z*b;

 if(n==0 )
 {
	 if(m!=0)
 cout<<0<<endl;
	 else
		 cout<<-1<<endl;
 }
 else
 {
 cout<<1<<endl;
 }
return 0;
}

#include<bits/stdc++.h>

using namespace std;
void  p(int a)
{
    cout<<a;
    exit(0);
}
int main()
{
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    if(!a&!b&&c)p(0);
    if(!d&!e&&f)p(0);
    if(a*e==d*b)
        if(a*f==d*c)p(-1);
        else p(0);
    else p(1);
}

#include <cstdio>
using namespace std;

int main(){
    int A,B,C,D,E,F;
    scanf("%d%d%d",&A,&B,&C);
    scanf("%d%d%d",&D,&E,&F);
    if(!A && !B || !D && !E) return puts("-1");
    puts(A*E!=B*D?"1":(C==F?"-1":"0"));
}

// clang-format off
// very important, much wow, such don't touch this
#define protected public
using iii = int; using yeee = iii;

#ifdef LOCAL
const iii DEBUG = 10;
#else
const iii DEBUG = -1;
#endif
#define DBG(x) if(DEBUG >= x)

#include <bits/stdc++.h>
using namespace std;

#define FOR(i, lo, hi) for(ll i = ll(lo); i < ll(hi); ++i)
#define ROF(i, hi, lo) for(ll i = ll(hi); i >= (ll)(lo); --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ll((x).size())
#define pb push_back
#define apply(f, x, y) (x) = f((x), (y))

using ll = long long; using ull = unsigned long long; using ld = long double; using pll = pair<ll, ll>; using vb = vector<bool>; using vvb = vector<vb>; using vll = vector<ll>; using vvll = vector<vll>; using vpll = vector<pll>; using point = complex<ll>; /* template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; */ /*|||*/ template <class T> T get() { T x; cin >> x; return x; } template <class T1, class T2> ostream &operator<<(ostream &out, const pair<T1, T2> &cont) { out << "(" << cont.first << ", " << cont.second << ")"; return out; } template <class T> ostream &operator<<(ostream &out, const vector<T> &cont) { for(long long int i=0; i < (long long int)(cont.size()); ++i) out << (i ? " " : "") << cont[i]; return out; } template <class T> ostream &operator<<(ostream &out, const set<T> &cont) { out << "{"; for(const T &x : cont) out << x << ", "; out << "}"; return out; } template <class T, class U> ostream &operator<<(ostream &out, const map<T, U> &cont) { out << "{"; for(const pair<T, U> &x : cont) out << "(" << x.first << ": " << x.second << "), "; out << "}"; return out; } template <class T> ostream &operator<<(ostream &out, vector<vector<T>> &cont) { for(vll &v : cont) { for(long long int i = 0; i < (long long int)(v.size()); ++i) { out << (i ? " " : "") << v[i]; } out << "\n"; } return out; } /*|||*/ void setup_io(string input_file = "", string output_file = "") { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(unsigned(time(0))); DBG(0 && input_file != "") freopen(input_file.c_str(), "r", stdin); DBG(0 && output_file != "") freopen(output_file.c_str(), "w", stdout); } /*|||*/ std::chrono::_V2::system_clock::time_point get_time() { return chrono::high_resolution_clock::now(); } ld get_duration(std::chrono::_V2::system_clock::time_point start_time, std::chrono::_V2::system_clock::time_point end_time) { return ld(chrono::duration_cast<chrono::nanoseconds>(end_time - start_time).count()) / 1e9; } /*|||*/ ll sign(ld x) { return (x > 0) - (x < 0); } ll pow(ll x, ll exp, ll mod) { ll res = 1, y = x; while(exp) { if(exp & 1) res = (res * y) % mod; y = (y * y) % mod; exp >>= 1; } return res; } /*|||*/ auto START_TIME = get_time(); const long long INF = LONG_LONG_MAX / 3; char newl = '\n';
// clang-format on

ll gcd(ll a, ll b) {
    if(a || b)
        return __gcd(a, b);
    return 1;
}

yeee main() {
    setup_io();
    //

    vvll P(2, vll(3));
    FOR(i, 0, len(P))
        FOR(j, 0, len(P[i]))
            cin >> P[i][j];

    FOR(i, 0, 2) {
        ll g = gcd(P[i][0], gcd(P[i][1], P[i][2]));
        FOR(j, 0, 3)
            P[i][j] /= g;

        bool flip = false;
        FOR(j, 0, 3) {
            if(P[i][j] < 0)
                flip = true;
            else if(P[i][j] == 0)
                continue;
            else
                break;
        }

        if(flip)
            FOR(j, 0, 3)
                P[i][j] *= -1;
    }

    if(P[0] == P[1]) {
        cout << -1 << newl;
    } else if(P[0][0] == P[1][0] && P[0][1] == P[1][1]) {
        cout << 0 << newl;
    } else {
        cout << 1 << endl;
    }
}

#include <bits/stdc++.h>
using namespace std;
int n,a1,b1,c1,a2,b2,c2;
main(){
    cin>>a1>>b1>>c1>>a2>>b2>>c2;
    int D,Dx,Dy;
    c1=-c1;
    c2=-c2;
    D=a1*b2-a2*b1;
    Dx=c1*b2-c2*b1;
    Dy=a1*c2-a2*c1;
    if(D==0){
        if(Dx+Dy==0) cout<<-1;
        else cout<<0;
    }
    else cout<<1;
}

#include <iostream>

using namespace std;
int main(){
	double a1,b1, c1, a2, b2, c2;
	cin>> a1>> b1>> c1;
	cin>> a2>> b2>> c2;

	if(b1!=0) {
		if (b2!=0){
			if (a1/b1==a2/b2 && c1==c2) {cout<<"-1"<<endl; return 0;}
			else if ((a1/b1==a2/b2 && c1!=c2)) {cout<<"0"<<endl; return 0;}
			else {cout<<"1"<<endl; return 0;}
		} else {
			if (a2==0&&c2!=0) {cout<<"0"<<endl; return 0;}
			else if (a2==0&&c2==0)  {cout<<"-1"<<endl; return 0;}
			else {cout<<"1"<<endl; return 0;}
		}
	} else{
		if (b2!=0){
			if (a1==0&&c1!=0) {cout<<"0"<<endl; return 0;}
			else if (a1==0&&c1==0)  {cout<<"-1"<<endl; return 0;}
			else {cout<<"1"<<endl; return 0;}
		} else {
			if (a1==0){
				if(a2==0){
					if (c1!=0 ||c2!=0) {cout<<"0"<<endl; return 0;}
					else {cout<<"-1"<<endl; return 0;}
				}else{
					if (c1==0){cout<<"-1"<<endl; return 0;}
					else{cout<<"0"<<endl; return 0;}
				}
			} else {
				if(a2==0){
					if (c2==0){cout<<"-1"<<endl; return 0;}
					else{cout<<"0"<<endl; return 0;}
				}else{
					if (c1/a1==c2/a2) {cout<<"-1"<<endl; return 0;}
					else  {cout<<"0"<<endl; return 0;}
				}
			}

		}
	}

	return 0;
}

#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	if(a*e==b*d&&a*f==d*c){
		cout<<"-1";
		return 0;
	}
	if(a*e==b*d&&a*f!=d*c){
		cout<<"0";
		return 0;
	}
	cout<<1;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
int gcd(int a, int b){
    if(a == 0 && b == 0)
        return 1;
    if(b == 0)
        return a;
    return gcd(b,a%b);
}
void normalize(int &a, int &b, int &c){
    int g = gcd(gcd(a,b),c);
    a /= g;
    b /= g;
    c /= g;
    if(a < 0 || (a == 0 && b < 0) || (a == 0 && b == 0 && c < 0)){
        a /= -1;
        b /= -1;
        c /= -1;
    }
}
int main(){
    int a,b,c;
    int x,y,z;
    cin >> a >> b >> c >> x >> y >> z;
    normalize(a,b,c);
    normalize(x,y,z);
    if(x == a && b == y && c == z || (x == 0 && y == 0) || (a == 0 &&  b == 0))
        puts("-1");
    else if(x == a && b == y && c != z)
        puts("0");
    else
        puts("1");
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <string.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cctype>

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long lint;

#define MP make_pair
#define PB push_back
#define EPS 0.0000001
#define ALL(a) a.begin(), a.end()

const lint INF_L = 2000 * 1000 * 1000;
const ll INF_LL = 1LL * INF_L * INF_L;
const ll MOD = 1000000000007LL;

ll gcd(ll a, ll b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

ll lcm(ll a, ll b) {
	return (a / gcd(a, b)) * b;
}

#define ONLINE_JUDGE
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a, b, c, x, y, z;
	cin >> a >> b >> c >> x >> y >> z;
	if (a == 0 && b == 0 && c != 0 || x == 0 && y == 0 && z != 0) {
		cout << 0 << endl;
	}
	else if (a * y == b * x) {
		if (a * z == c * x) {
			cout << -1 << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
	else {
		cout << 1 << endl;
	}

	return 0;
}

#include <bits/stdc++.h>
typedef long long Long;
#define para(i,n) for(Long i=0;i<(Long)n;i++)
using namespace std;
int main(){

    int a,b,c,x,y,z;
    cin>>a>>b>>c>>x>>y>>z;
    int maxim= max({a,b,c}),maxim2= max({x,y,z});
    if(maxim2<maxim){
        swap(a,x);
        swap(b,y);
        swap(c,z);
        swap(maxim2,maxim);
   }
   if(maxim==0){
       if(maxim2==0){
           cout<<-1<<endl;
           return 0;
       }
       cout<<0<<endl;
       return 0;
   }
   int fact=maxim2/maxim;
   int para=0;
   if(a*fact==x){
       para++;
   }
   if(b*fact==y){
       para++;
   }
   if(para==2){
       if(c*fact==z)cout<<-1<<endl;
       else cout<<0<<endl;
   }else{
       cout<<1<<endl;
   }
    return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int a,b,c,A,B,C;
    cin >> a >> b >> c >> A >> B >> C;
    int gcd;
    if(a==0 && b==0) gcd = 1;
    else if (a==0) gcd =b;
    else if (b==0) gcd = a;
    else gcd = __gcd(a,b);
    a/=gcd;
    b/=gcd;
    if(A==0 && B==0) gcd = 1;
    else if (A==0) gcd =B;
    else if (B==0) gcd = A;
    else gcd = __gcd(A,B);
    A/=gcd;
    B/=gcd;
    if(a==A&&B==b)
    {
        if(C==c) cout << -1;
        else cout << 0;
    }
    else cout << 1;
    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <ctime>
#include <cmath>
#include <conio.h>

#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <list>
#include <vector>
#include <iostream>
#include <utility>

#define MP make_pair
#define FF fflush(stdin)
#define PB push_back
#define ST first
#define ND second
#define LL long long
#define SZ(y) (int)(y).size()
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,x,n) for(int(i)=x;(i)<(n);++(i))
#define FORN(i,x,n) for(int(i)=x;(i)<=(n);++(i))
#define RFOR(i,x,n) for(int(i)=x;(i)>=(n);--(i))
#define TR(c,i) for(typeof((c).begin()) i=(c).begin(); (i)!=(c).end(); ++(i))
#define TRR(c,i) for(typeof((c).rbegin()) i=(c).rbegin(); (i)!=(c).rend(); ++(i))

using namespace std;

int main() {
    int a,b,c,d,e,f;

    cin >> a >> b >> c;
    cin >> d >> e >> f;
    if (a!=d||b!=e||c!=f) {a*=(-1);b*=(-1);c*=(-1);}
    if (b<0) {b *= (-1); a *= (-1); c *= (-1);}
    if (e<0) {e *= (-1); d *= (-1); f *= (-1);}
    if (a==0&&b==0&&c==0 || d==0&&e==0&&f==0) {printf("-1\n"); return 0;}
    if (a==0&&b==0 || d==0&&e==0) {printf("0\n"); return 0;}

    if ((a==0&&d==0)) {
       if ((c!=0)&&(f!=0)) {
          if ((b==(-1)*e)||(c==(-1)*f)) {printf("0\n");return 0;}
          if (((b%e)==0)&&((c%f)==0)) {b/=(b/e);c/=(c/f);} else
          if (((e%b)==0)&&((f%c)==0)) {e/=(e/b);f/=(f/c);}
       }
       else {
          if (((b%e)==0)) {b/=(b/e);} else
          if (((e%b)==0)) {e/=(e/b);}
       }
       if (b==e&&c==f) printf("-1\n");
       else printf("0\n");//system("pause");
       return 0;
    }
    if ((b==0&&e==0)) {
       if ((c!=0)&&(f!=0)) {
          if ((a==(-1)*d)||(c==(-1)*f)) {printf("0\n");return 0;}
          if (((a%d)==0)&&((c%f)==0)) {a/=(a/d);c/=(c/f);} else
          if (((d%a)==0)&&((f%c)==0)) {d/=(d/a);f/=(f/c);}
       }
       else {
          if (((a%d)==0)) {a/=(a/d);} else
          if (((d%a)==0)) {d/=(d/a);}
       }
       if (a==d&&c==f) printf("-1\n");
       else printf("0\n");//system("pause");
       return 0;
    }
/*    if ((a==0&&d==0)&&(c==f)) {
       if (((b%e)==0)) {b/=(b/e);}
       if (((e%b)==0)) {e/=(e/b);}
       if (b==e) printf("-1\n");
       else printf("0\n");system("pause");
       return 0;
    }
    if ((b==0&&e==0)&&(c==f)) {
       if (((a%d)==0)) {a/=(a/d);}
       if (((d%a)==0)) {d/=(d/a);}
       if (a==d) printf("-1\n");
       else printf("0\n");system("pause");
       return 0;
    }*/

    double aa = a,bb=b,cc=c,dd=d,ee=e,ff=f;

    if (((-1*aa)/bb)==((-1*dd)/ee) && ((-1*cc)==(-1*ff))) {printf("-1\n"); return 0;}
    if (((-1*aa)/bb)==((-1*dd)/ee) && ((-1*cc)!=(-1*ff))) {printf("0\n"); return 0;}
    printf("1\n");

//    system("pause");
    return 0;

}

#include <algorithm>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <iostream>
#include <fstream>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
using namespace std;
#define FOR(i,n) for (int i=0; i<n; ++i)
#define FORE(i,n) for (int i=0; i<=n; ++i)
#define REP(i,a,b) for (int i=a; i<b; ++i)
#define REPE(i,a,b) for (int i=a; i<=b; ++i)
#define ALL(c) (c).begin(), (c).end()
#define DEC(i,n) for(int i=n-1;i>=0;i--)
#define SORT(c) sort(ALL(c))

typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long int LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
const double pi = acos(-1.0);
const int INF =(int) 1e9;
const LL prime = 31;

//////////////////////////////////////////////////////////////////////////////
                            #define PeaceOnYou 1
//////////////////////////////////////////////////////////////////////////////

bool symb(char x)
{
    if(x>='a' && x<='z' ||x=='_'||x>='0'&&x<='9'||x>='A'&&x<='Z') return true;
    else return false;
}
bool checkusername(string s)
{
    if(s.size()<1 ||s.size()>16) return false;
    bool result = true;
    FOR(i,s.size())
    {
        result&=symb(s[i]);
    }
    return result;
}
int main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int a1,a2,b1,b2,c1,c2;
    cin>>a1>>b1>>c1>>a2>>b2>>c2;
    if(a1*b2==a2*b1)
    {
        if(c1*b2 == b1*c2) cout<<-1;
        else cout<<0;
    }
    else
    {
        cout<<1;
    }
}

#include <iostream>
#include <cmath>
using namespace std;
typedef double db;
static const db EPS=1e-8;
int a1,b1,c1,a2,b2,c2;
int sgn(db x)
{
    if(fabs(x)<EPS) return 0;
    if(x<0) return -1;
    return 1;
}
struct Point{
    db x,y;
    Point(){}
    Point(db _x,db _y):x(_x),y(_y){}
    Point operator - (const Point &b)const{ return Point(x-b.x,y-b.y); }
    db operator ^ (const Point &b)const{
        return x*b.y-y*b.x;
    }
};
struct Line{
    Point s,e;
    Line(){}
    Line(db a,db b,db c)
    {
        if(sgn(a)==0) { s=Point(0,-c/b); e=Point(1,-c/b); }
        else if(sgn(b)==0) { s=Point(-c/a,0); e=Point(-c/a,1); }
        else { s=Point(0,-c/b); e=Point(1,(-c-a)/b); }
    }
    bool parallel(Line v) { return sgn((e-s)^(v.e-v.s))==0; }
    int relation(Point p)
    {
        int c=sgn((p-s)^(e-s));
        if(c<0) return 1;
        else if(c>0) return 2;
        return 3;
    }
    int linecrossline(Line v)
    {
        if((*this).parallel(v)) return v.relation(s)==3;
        return 2;
    }
};

int main()
{
    scanf("%d%d%d%d%d%d",&a1,&b1,&c1,&a2,&b2,&c2);
    int t=Line(a1,b1,c1).linecrossline(Line(a2,b2,c2));
    if(t==0) puts("0");
    else if(t==1) puts("-1");
    else puts("1");
    return 0;
}

#include<iostream>
using namespace std;
int main(){
    int a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2 ;
    int ans = 1;
    if(!a1 && !b1 && c1)
        ans = 0;
    else if(!a2 && !b2 && c2)
        ans = 0;
    else if(a1 * b2 == a2 * b1){
        if(a1 * c2 == a2 * c1 && b1 * c2 == b2 * c1)
            ans = -1;
        else if(a1 * c2 == a2 * c1 || b1 * c2 == b2 * c1)
            ans = 0;
        else
            ans = -1;
    }
    cout << ans << endl;
    return 0;
}

//
//  Created by Running Photon on 2016-04-27
//  Copyright (c) 2015 Running Photon. All rights reserved.
//
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <sstream>
#include <set>
#include <vector>
#include <stack>
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x,begin())
#define ll long long
#define CLR(x) memset(x, 0, sizeof x)
using namespace std;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 10;
const int maxv = 1e3 + 10;
const double eps = 1e-5;

int main() {
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
//	freopen("out.txt","w",stdout);
#endif
//	ios_base::sync_with_stdio(0);
    double a1, b1, c1, a2, b2, c2;
    while(cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2) {
        if(a1 < 0) {a1 = -a1, b1 = -b1, c1 = -c1;}
        else if(a1 == 0 && b1 < 0) b1 = -b1, c1 = -c1;
        if(a2 < 0) {a2 = -a2, b2 = -b2, c2 = -c2;}
        else if(b2 < 0) b2 = -b2, c2 = -c2;
        int f = 1;
        if(a1 < eps && abs(b1) < eps && abs(c1) > eps || a2 < eps && abs(b2) < eps && abs(c2) > eps) f = 0;
        double p1 = atan2(b1, a1);
        double p2 = atan2(b2, a2);
        int res;
        if(f == 0) res = 0;
        else if(a1 < eps && abs(b1) < eps && abs(c1) < eps || a2 < eps && abs(b2) < eps && abs(c2) < eps) res = -1;
        else if(abs(p1 - p2) > eps) res = 1;
        else if((a1 > 0 && a2 > 0 || abs(b1) > 0 && abs(b2) > 0) && abs(c1 / max(a1, abs(b1)) - c2 / max(a2, abs(b2))) < eps || abs(c1) < eps && abs(c2) < eps) res = -1;
        else res = 0;
        cout << res << endl;
    }

	return 0;
}

#include <iostream>

using namespace std;
int main(){
	double a1,b1, c1, a2, b2, c2;
	cin>> a1>> b1>> c1;
	cin>> a2>> b2>> c2;

	if(b1!=0) {
		if (b2!=0){
			if (a1/b1==a2/b2 && c1==c2) {cout<<"-1"<<endl; return 0;}
			else if ((a1/b1==a2/b2 && c1!=c2)) {cout<<"0"<<endl; return 0;}
			else {cout<<"1"<<endl; return 0;}
		} else {
			cout<<"1"<<endl; return 0;
		}
	} else{
		if (b2!=0){
			cout<<"1"<<endl; return 0;
		} else {
			if (a1==0){
				if(a2==0){
					if (c1!=0 ||c2!=0) {cout<<"0"<<endl; return 0;}
					else {cout<<"-1"<<endl; return 0;}
				}else{
					if (c1==0){cout<<"-1"<<endl; return 0;}
					else{cout<<"0"<<endl; return 0;}
				}
			} else {
				if(a2==0){
					if (c2==0){cout<<"-1"<<endl; return 0;}
					else{cout<<"0"<<endl; return 0;}
				}else{
					if (c1/a1==c2/a2) {cout<<"-1"<<endl; return 0;}
					else  {cout<<"0"<<endl; return 0;}
				}
			}

		}
	}

	return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <list>
#include <fstream>
#define ull unsigned long long
#define ll long long
#define ld long double
#define pi 3.1415926536
#define lp(i,n,a) for(ll i=a;i<=n;i++)
#define pl(i,n) for(ll i=n-1;i>=0;i--)
#define w while
#define re return
using namespace std;
int a,b,c,x,y,z,cnt;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    cin>>a>>b>>c;
    cin>>x>>y>>z;
    if(a==x*-1)cnt++;
    if(b==y*-1)cnt++;
    if(c==z*-1)cnt++;
    if((!a&&!b&&c)||(!x&&!y&&z)){cout<<"0\n";re 0;}
    if(abs(a)==abs(x)&&abs(b)==abs(y)&&abs(c)==abs(z)&&(cnt%2==0))
    if((!a&&!b&&!c)||(!x&&!y&&!z)||(a==x&&b==y&&c==z)){cout<<"-1\n";re 0;}
    if(a*y==x*b&&x*c==z*a&&a&&x){cout<<"-1\n";re 0;}
    if(a*y==x*b){cout<<"0\n";re 0;}
    cout<<"1\n";
	re 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
int gcd(int a, int b){
    if(a == 0 && b == 0)
        return 1;
    if(b == 0)
        return a;
    return gcd(b,a%b);
}
void normalize(int &a, int &b, int &c){
    int g = gcd(gcd(a,b),c);
    a /= g;
    b /= g;
    c /= g;
    if(a < 0 || (a == 0 && b < 0) || (a == 0 && b == 0 && c < 0)){
        a /= -1;
        b /= -1;
        c /= -1;
    }
}
int main(){
    int a,b,c;
    int x,y,z;
    cin >> a >> b >> c >> x >> y >> z;
    normalize(a,b,c);
    normalize(x,y,z);
    if((x == 0 && y == 0 && z != 0) || (a == 0 &&  b == 0 && c != 0))
        puts("0");
    else if(x == a && b == y && c == z || (x == 0 && y == 0 && z == 0) || (a == 0 &&  b == 0 && c == 0))
        puts("-1");
    else if(x/gcd(x,y) == a/gcd(a,b) && b/gcd(a,b) == y/gcd(x,y) && c != z)
        puts("0");
    else
        puts("1");
}

//
#include <bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define inf 1000000000000000000
using namespace std;
int main ()
{
    int a,b,c,x,y,z;
    cin>>a>>b>>c>>x>>y>>z;
    int ans;
    if ((a==0 && b==0 && c) || (x==0 && y==0 && z)) {
        ans=0;
    }
    else if (a*y==b*x) {
        if (a*z==c*x && b*z==c*y) {
            ans=-1;
        }
        else {
            ans=0;
        }
    }
    else {
        ans=1;
    }
    return 0;
}

#include<iostream>
using namespace std;
int main(){
	int A1,B1,C1,A2,B2,C2,S,X,Y;
	cin>>A1>>B1>>C1;
	cin>>A2>>B2>>C2;
	S = (A1*B2 - A2*B1);
	X = (C1*B2 - C2*B1);
	Y = (A1*C2 - A2*C1);
	if(S != 0 ) cout<<1<<endl;
	else
		if(S == 0 && X == 0 && Y == 0) cout<<-1<<endl;
		else
			cout<<0<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int a ,b ,c ,a1 ,b1 ,c1;
    cin>>a>>b>>c>>a1>>b1>>c1 ;
    if(b==0 and b1==0)
        cout<<-1 ;
    else {
    int m1=-(a/b) ;
    int m2=-(a1/b1) ;
    if(m1==m2 and c==c1)
        cout<<-1 ;
    else
        cout<<1 ;
}
}

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    int j,k,l;
    cin>>a>>b>>c;
    cin>>j>>k>>l;
    if(a==0&&b==0)
        cout<<-1;
    else if(j==0&&k==0)
        cout<<-1;
    else if(a==0&&j==0)
    {
        if(c*1.0/b==l*1.0/k)
            cout<<-1;
        else
            cout<<0;
    }
    else if(a==0&&k==0)
        cout<<1;
    else if(a==0&&j&&k)
        cout<<1;
    else if(b==0&&j==0)
        cout<<1;
    else if(b==0&&k==0)
    {
        if(c*1.0/a==l*1.0/j)
            cout<<-1;
        else
            cout<<0;
    }
    else if(b==0&&j&&k)
        cout<<1;
    else if(a&&b&&j==0)
        cout<<1;
    else if(a&&b&&k==0)
        cout<<1;
    else if(a&&b&&j&&k)
    {
        if(b*1.0/a==k*1.0/j)
        {
            if(c*1.0/a==l*1.0/j)
                cout<<-1;
            else
                cout<<0;
        }
        else
            cout<<1;
    }
    return 0;
}

#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<iostream>
#include<algorithm>

using namespace std;

#define	EPS	1e-5

int main()
{
	int a1,a2,b1,b2,c1,c2;
	cin>>a1>>b1>>c1>>a2>>b2>>c2;

	if(a1*b2-b1*a2!=0)	cout<<1;
	else{
		if     (a1==0 && b1==0 && c1!=0)	cout<<0;	// null set
		else if(a2==0 && b2==0 && c2!=0)	cout<<0;
		else{
			double n1=sqrt(a1*a1+b1*b1+c1*c1);
			double n2=sqrt(a2*a2+b2*b2+c2*c2);
			if(n1==EPS || n2==EPS)	cout<<-1;	// universal set
			else{
				double a1_,a2_,b1_,b2_,c1_,c2_;
				a1_=a1/n1;	b1_=b1/n1;	c1_=c1/n1;
				a2_=a2/n2;	b2_=b2/n2;	c2_=c2/n2;
				if(fabs(a1_-a2_)<EPS && fabs(b1_-b2_)<EPS && fabs(c1_-c2_)<EPS)	cout<<-1;
				else	cout<<0;
			}
		}
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 100005

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
    /*ll x = __gcd(__gcd(a1, b1), c1), y = __gcd(__gcd(a2, b2), c2);
    a1 /= x; b1 /= x; c1 /= x; a2 /= y; b2 /= y; c2 /= y;
    if(a1 < 0){
        a1 = -a1; b1 = -a1; c1 = -a1;
    }
    if(a2 < 0){
        a2 = -a2; b2 = -b2; c2 = -c2;
    }*/
    if(a1 == b1 && a1 == 0){
        if(c1 == 0){
            if(a2 == b2 && a2 == 0){
                if(c2 == 0){
                    cout << "-1\n";
                } else{
                    cout << "0\n";
                }
            } else{
                cout << "-1\n";
            }
        } else{
            cout << "0\n";
            return 0;
        }
    }
    if(a1*b2==b1*a2){
        /*if(a1 == a2 && b1 == b2 && c1 == c2){
            cout << "-1\n";
        } else{
            cout << "0\n";
        }*/
        if(a1*c2==a2*c1 && b1*c2==c1*b2){
            cout << "-1\n";
        } else{
            cout << "0\n";
        }
    } else{
        cout << "1\n";
    }
    //bruh moment

    return 0;
}

using namespace std;
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cassert>
#include<set>
#include<cstring>
#include<deque>

typedef double D; typedef long long LL;
typedef vector<int> VI; typedef vector<VI> VVI;
typedef vector<bool> VB; typedef vector<VB> VVB;
typedef pair<int,int> pii; typedef vector<pii> VII;
#define IA(v) (v).begin()
#define IB(v) (v).end()
#define ALL(v) IA(v),IB(v)
#define REP(i, n) for (int i (0); i < (n); i ++)
#define FORIT(a,b, it) for(__typeof(b)it(a);it!=b;++it)
#define FOREACH(v, it) FORIT(IA(v),IB(v),it)
#define len(v) ((int)(v).size())
#define append push_back
#define _ make_pair
#define fi first
#define se second
#define add insert
#define remove erase
const int inf (1010101010);

template<class T> T xgcd(T a, T b, pair<T,T> & res) { // returnt gcd(a, b)
	if (b == 0) { res = _(1, 0); return a; }
	else
	{
		T d = xgcd(b, a%b, res);
		T t=res.fi;res.fi=res.se;res.se=t-(a/b)*res.se;
		return d;
	}
}

LL det(LL a, LL b, LL c, LL d)
{
	return a * d - b * c;
}

main()
{
	int a1, b1, c1; cin >> a1 >> b1 >> c1;
	int a2, b2, c2; cin >> a2 >> b2 >> c2;

	if (abs(a2) < abs(a1))
	{
		swap(a1,a2),swap(b1,b2),swap(c1,c2);
	}

	if (a1 == 0 && b1 == 0)
	{
		if (c1) { puts("0"); return 0; }
		if (a2 == 0 && b2 == 0)
		{
			if (c2) { puts("0"); return 0; }
			puts("-1");
		}
		else
		{
			pii s1; int g = xgcd(a2,b2,s1); if (c2 % g) { puts("0"); return 0; }
			puts("1"); return 0;
		}
	}

	pii sol1, sol2;
	int g1 (xgcd(a1, b1, sol1)), g2 (xgcd(a2, b2, sol2));
	if (c1 % g1 || c2 % g2) { puts("0"); return 0; }

	int x1 (sol1.fi), y1 (sol1.se), x2 (sol2.fi), y2 (sol2.se);
	// x1*a1 + y1*b1 == g1
	x1 *= c1 / g1, y1 *= c1 / g1;
	x2 *= c2 / g2, y2 *= c2 / g2;
	assert(x1*a1 + y1*b1 == c1);
	assert(x2*a2 + y2*b2 == c2);

	// x1 + b1*k1 == x2 + b2*k2
	// y1 - a1*k1 == y2 - a2*k2

	//  b1 -b2 | (x2 - x1)
	// -a1  a2 | (y2 - y1)
	// (k1)(k2)

	LL c11 (b1), c12 (-b2), c21 (-a1), c22 (a2);
	LL B1 (x2 - x1), B2 (y2 - y1);

	LL dd (det(c11, c12, c21, c22));
	LL d1 (det( B1, c12,  B2, c22));
	LL d2 (det(c11,  B1, c21,  B2));
	if (dd == 0)
	{
		if (d1 == 0) puts("-1");
		else puts("0");
		return 0;
	}
	else
	{
		if (d1 % dd || d2 % dd) { puts("0"); return 0; }
		puts("1");
	}
}

#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    if (a * e == b * d && b * f == c * e)
        cout << "-1";
    else
    {
        if (a * e == b * d)
            cout << "0";
        else
            cout << "1";
    }
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int a1,b1,c1,a2,b2,c2;
	cin>>a1>>b1>>c1;
	cin>>a2>>b2>>c2;
	if(a1==0&&b1==0&&c1!=0)
	cout<<"0"<<endl;
	else if(a2==0&&b2==0&&c2!=0)
	cout<<"0"<<endl;
	else if(a1*b2==a2*b1)
	{
		if(a1*c2==a2*c1)
		cout<<"-1"<<endl;
		else
		cout<<"0"<<endl;
	}
	else
	cout<<"1"<<endl;
	return 0;
}

/* -*- coding: utf-8 -*-
 *
 * 0021B.cc: B. Intersection
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

int gcd(int m, int n) {
  m = abs(m), n = abs(n);
  if (m < n) swap(m, n);
  while (n > 0) {
    int r = m % n;
    m = n;
    n = r;
  }
  return m;
}

void normalize(int &a, int &b, int &c) {
  int g = gcd(gcd(a, b), c);
  if (g > 1) a /= g, b /= g, c /= g;

  if (a < 0) a = -a, b = -b, c = -c;
  else if (a == 0) {
    if (b < 0) b = -b, c = -c;
    else if (b == 0 && c < 0) c = -c;
  }
}

/* main */

int main() {
  int a0, b0, c0, a1, b1, c1;
  scanf("%d%d%d", &a0, &b0, &c0);
  scanf("%d%d%d", &a1, &b1, &c1);

  normalize(a0, b0, c0);
  normalize(a1, b1, c1);
  //printf("%d %d %d\n", a0, b0, c0);
  //printf("%d %d %d\n", a1, b1, c1);

  if (a0 * b1 - b0 * a1 == 0)
    printf("%d\n", (a0 == a1 && b0 == b1 && c0 == c1) ? -1 : 0);
  else
    puts("1");
  return 0;
}

#include <iostream>
using namespace std;
int a,b,c,e,f,g;
int main(){
           cin>>a>>b>>c>>e>>f>>g;
	   if (a==0 && b==0 && c!=0 || e==0 && f==0 && g!=0){
	   cerr<<0;
	   return 0;
	   }
	   if (a*f==b*e){
	      if(a*g==e*c && b*g==f*c) cerr<<-1; else cerr<<0;
	      return 0;
	   }
	    cerr<<1;
	    return 0;
}

#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

struct line {
	int a, b, c;
};

int main() {
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	line l1, l2;
	cin >> l1.a >> l1.b >> l1.c;
	cin >> l2.a >> l2.b >> l2.c;
	if (l1.a * l2.b - l2.a * l1.b != 0)
		cout << 1;
	else {
		if (l1.a * l2.c - l2.a * l1.c == l1.b * l2.c - l2.b * l1.c)
			cout << -1;
		else cout << 0;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
#define CLR(arr,val) memset(arr,val,sizeof(arr))

typedef long long LL;

int main(){
    double a1,b1,c1;
    double a2,b2,c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;
    if(b1==0&&b2==0){
        if(a1==0||a2==0) cout<<-1<<endl;
        else if((c1/a1)==(c2/a2)) cout<<-1<<endl;
        else cout<<0<<endl;
    }
    else if(b1==0){
        if(a1==0&&c1==0) cout<<-1<<endl;
        else if(a1==0&&c1!=0) cout<<0<<endl;
        else cout<<1<<endl;
    }
    else if(b2==0){
        if(a2==0&&c2==0) cout<<-1<<endl;
        else if(a2==0&&c2!=0) cout<<0<<endl;
        else cout<<1<<endl;
    }
    else if((a1/b1)==(a2/b2)){
        if((c1/b1)==(c2/b2)) cout<<-1<<endl;
        else cout<<0<<endl;
    }
    else cout<<1<<endl;

    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <iterator>
#include <cmath>
#include <deque>
using namespace std;

int gcd(int a, int b)
{
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}

int main()
{
    if (fopen("input.txt", "r")) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
    int f = 0;
    if (a1 == 0 && b1 == 0) {
        if (c1 != 0) {
            cout << 0;
            return 0;
        }
        f = -1;
    }
    if (a2 == 0 && b2 == 0) {
        if (c2 != 0) {
            cout << 0;
            return 0;
        }
        f = -1;
    }
    if (f < 0) {
        cout << -1;
        return 0;
    }
    if (a1 < 0) {
        a1 = -a1;
        b1 = -b1;
        c1 = -c1;
    }
    if (a2 < 0) {
        a2 = -a2;
        b2 = -b2;
        c2 = -c2;
    }
    int g1 = gcd(a1, abs(b1));
    int g2 = gcd(a2, abs(b2));
    a1 /= g1;
    b1 /= g1;
    a2 /= g2;
    b2 /= g2;
    if (a1 == a2 && b1 == b2) {
        if (c1 * g2 == c2 * g1)
            cout << -1;
        else
            cout << 0;
    }
    else {
        cout << 1;
    }
    return 0;
}

//B

#include <cstdio>
#include <cstring>

int A[2],B[2],C[2];

bool IsEmpty(int i)
{
    if(A[i]==0 && B[i]==0 && C[i]!=0)return true;
    return false;
}

bool IsFull(int i)
{
    if(A[i]==0 && B[i]==0 && C[i]==0)return true;
    return false;
}

int main()
{
    while(scanf("%d%d%d",A,B,C)==3){
        scanf("%d%d%d",A+1,B+1,C+1);

        if(IsEmpty(0) || IsEmpty(1)){
            puts("0");
            continue;
        }

        if( IsFull(0) || IsFull(1) ){
            puts("-1");
            continue;
        }

        if( A[0]*B[1] == A[1]*B[0] ){
            if(A[0]*C[1]==A[1]*C[0])puts("-1");
            else puts("0");
        }
        else{
            puts("1");
        }

    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
double a1,b1,c1,a2,b2,c2;
int solve() {
	if(b1||b2) {
		if(!(a1||b1)||!(a2||b2)) {
			if(!c1||!c2) return -1;
			return 0;
		}
		if(!b1||!b2) return 1;
	} else {
		if(!(a1||a2)&&c1&&c2) return 0;
		if(!(a1||a2||c1||c2)&&a1/c1==a2/c2) return -1;
		return 0;
	}
	if(a1/b1==a2/b2) {
		if(c1/b1==c2/b2) return -1;
		return 0;
	}
	return 1;
}
int main() {
	cin>>a1>>b1>>c1>>a2>>b2>>c2;
	cout<<solve();
	return 0;
}

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#define oo 1e8
#define eps 1e-8

using namespace std;

int gcd(int x, int y){
        x = abs(x);
        y = abs(y);
        if (x>y){int temp = x; x = y; y = temp;}
        if (x==0) return y;
        return gcd(y%x, x);
}

int m, n, q, w, e, r, a, b, c, ans, g1, g2;
double s1, s2;

int main(){
        scanf("%d%d%d", &a, &b, &c);
        scanf("%d%d%d", &q, &w, &e);
        if ((a==0 && b==0 && c!=0) || (q==0 && w==0 && e!=0)) {printf("0\n"); return 0;}
        else {
                if (a==0 && b==0 && c==0){
                        if (e==0){
                                printf("1\n");
                        } else {
                                printf("0\n");
                        }
                        return 0;
                } else
                if (q==0 && w==0 && e==0) {
                        if (c==0){
                                printf("1\n"); return 0;}
                        else {printf("0\n"); return 0;}
                }
        }
        g1 = gcd(gcd(a, b), c);
        g2 = gcd(gcd(q, w), e);
        a/=g1; b/=g1; c/=g1; q/=g2; w/=g2; e/=g2;
//      printf("%d %d %d\n", a, b, c);
//      printf("%d %d %d\n", q, w, e);
        if (b==0) s1 = oo;
        else s1 = (double) a/b;

        if (w==0) s2 = oo;
        else s2 = (double) q/w;
        if (a==q && b==w && c==e || a==-q && b==-w && c==-e)
                printf("-1\n");
        else
        if (s1 == oo && s2 == oo){
                if (abs(((double)(c))/a - ((double)(e))/q) < eps)
                        ans = -1;
                else
                        ans = 0;
                printf("%d\n", ans);
        }
        else
                if (s1 == 0 && s2 == 0){
                        if (abs(((double)(c))/b - ((double)(e))/w) < eps)
                                ans = -1;
                        else
                                ans = 0;
                printf("%d\n", ans);
        }else
        if (abs(s1 - s2) < eps)
                printf("0\n");
        else printf("1\n");
        /*
        if (s1 == oo && s2 == oo){
                if (abs(((double)(c))/a - ((double)(e))/q) < eps)
                        ans = -1;
                else
                        ans = 0;
        }
        else
                if (s1 == 0 && s2 == 0){
                        if (abs(((double)(c))/b - ((double)(e))/w) < eps)
                                ans = -1;
                        else
                                ans = 0;
        }
        else
                if (abs(s1 - s2) < eps){
                        if (abs(((double)c)/b - ((double)e)/w) < eps)
                                ans = -1;
                        else
                                ans = 0;
                }
                else
                        ans = 1;
        printf("%d\n", ans);
        */
        return 0;
}

#include <iostream>

using namespace std;

int main() {
    int a1,b1,c1,a2,b2,c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;
    bool p;
    if (b1!=0) {
        if (b2==0)
            p=false;
        else {
            if ((a1*b2)==(a2*b1))
                p=true;
            else
                p=false;
        }
    } else {
        if (b2==0)
            p=true;
        else
            p=false;
    }
    if (p) {
        if (c1==c2)
            cout<<"-1"<<endl;
        else
            cout<<"0"<<endl;
    } else {
        cout<<"1"<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define pi acos(-1)
#define P pair<int,int>
#define fi first
#define se second
#define si signed
#define sc(x) scanf("%lld",&(x));
string s;

bool check(int i)
{

    if(s[i]=='_')return true;
    else
    {
        for(int j=0; j<26; j++)
        {
            if(s[i]=='a'+j||s[i]=='A'+j)
            {
                return true;
            }
        }

        for(int j=0; j<10; j++)
        {
            if(s[i]==j+'0')
            {
                return true;
            }
        }
        return false;
    }

}

signed main()
{
    int a1,a2,b1,b2,c1,c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;
    if((a1==0&&b1==0&&c1==0)||(a2==0&&b2==0&&c2==0)){
        cout<<-1<<endl;
        return 0;
    }
    if((a1==0&&b1==0&&c1)||(a2==0&&b2==0&&c2)){
        cout<<0<<endl;
    }
    else if(a1*b2==a2*b1){
        if(c1*b2==c2*b1&&a1*c2==a2*c1){
            cout<<-1<<'\n';
        }else cout<<0<<'\n';
    }else{
       cout<<1<<'\n';
    }
}

// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	int a1, b1, c1, a2, b2, c2;
	while(scanf("%d%d%d", &a1, &b1, &c1) != EOF) {
		scanf("%d%d%d", &a2, &b2, &c2);
		if(b1 == 0 && b2 == 0) {
			if(a1 == 0) {
				if(c1 == 0) printf("-1\n");
				else printf("0\n");
			}
			else if(a2 == 0) {
				if(c1 == 0) printf("-1\n");
				else printf("0\n");
			}
			else {
				double t1 = -c1*1.0/a1;
				double t2 = -c2*1.0/a2;
				if(fabs(t1-t2) <1e-12) printf("-1\n");
				else printf("0\n");
			}
			continue;
		}
		else if(b1) {
			double A = a2 - a1*b2*1.0/b1;
			double B = -(c1*a2*b2*1.0/b1);
			double C = c2;
			if(fabs(A)<1e-12 && fabs(B)<1e-12 && fabs(C)<1e-12) printf("-1\n");
			else {
				if(fabs(B*B-4*A*C)<1e-12) printf("1\n");
				else printf("0\n");
			}
		}
		else if(b2) {
			double A = a1 - a2*b1*1.0/b2;
			double B = -(c2*a1*b1*1.0/b2);
			double C = c1;
			if(fabs(A)<1e-12 && fabs(B)<1e-12 && fabs(C)<1e-12) printf("-1\n");
			else {
				if(fabs(B*B-4*A*C)<1e-12) printf("1\n");
				else printf("0\n");
			}
		}
	}
	return 0;
}

#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	if(a==0&&d==0){
		if(c!=f){
			cout<<"0";
			return 0;
		}
		else{
			cout<<"-1";
			return 0;
		}
	}
	if(a*e==b*d&&a*f==d*c){
		cout<<"-1";
		return 0;
	}
	if(a*e==b*d&&a*f!=d*c){
		cout<<"0";
		return 0;
	}
	cout<<1;
}

#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
    //freopen("test.txt", "r", stdin);
    int a1, b1, c1, a2, b2, c2;
    cin >> a1 >> b1 >> c1;
    cin >> a2 >> b2 >> c2;
    if((a1 == 0 && b1 == 0 && c1 == 0) ^ (a2 == 0 && b2 == 0 && c2 == 0)) printf("0");
    else{
        if(a1 * b2 == a2 * b1){
        if(c1 * a2 == c2 * a1 && c1 * b2 == c2 * b1) printf("-1");
        else printf("0");
        }else{
            printf("1");
        }
    }
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>

using namespace std;

int a1,a2,b1,b2,c1,c2;

int main()
{
	cin>>a1>>b1>>c1;
	cin>>a2>>b2>>c2;
	if(a1*b2-a2*b1==0)
	{
		if(b1*c2-b2*c1==0 && a1*c2-a2*c1==0) cout<<-1<<endl;
		else cout<<0<<endl;
		return 0;
	}
	cout<<1<<endl;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <sstream>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <stack>
using namespace std;

#pragma comment(linker,"/stack:16000000")
#pragma warning (disable : 4996)

#define ALL(v) v.begin(),v.end()
#define SZ(v) (int)v.size()
#define mset(A,x) memset((A),(x),sizeof(A))
#define FOR(i,start,N) for(int i=(start);i<(N);++i)
#define FORSZ(i,start,v) FOR(i,start,SZ(v))
#define REPSZ(i,v) FORSZ(i,0,v)
#define FORE(i,start,N) FOR(i,start,N+1)
#define make_unique(v) v.resize(unique(ALL(v))-v.begin())
#define debug(x) cout<<#x<<" = "<<x<<endl;
#define adebug(A,N) FOR(i,0,N) cout<<#A<<"["<<i<<"] = "<<A[i]<<endl;
#define adebug2d(a,n,m) FOR(i,0,n) { FOR(j,0,m) { cout<<a[i][j]<<" ";} cout<<endl;}
#define vdebug(v) REPSZ(i,v) cout<<#v<<"["<<i<<"] = "<<v[i]<<endl;
#define selfx(x,f,a) x = f(x,a)

typedef pair<int,int> pii;
typedef long long i64;
typedef vector<int> VI; typedef vector< vector<int> > VVI;
typedef vector<string> VS;

const int inf = 1<<25;
const double eps = 1e-9;

int gcd(int a,int b) { return !b?a:gcd(b,a%b);}

void unify(VI& a)
{
    int sign = 1;
    REPSZ(i,a)
        if(a[i]<0) { sign = -1; break; }

    REPSZ(i,a) a[i] =sign*a[i];

    int d = gcd(abs(a[0]),abs(a[1]));
    d = gcd(d,abs(a[2]));
    REPSZ(i,a)
        a[i]/=d;
}

int main()
{
#ifdef HOME_PC
    //freopen ("input.txt","r",stdin);
    //freopen ("in.txt","r",stdin);
    //freopen ("output.txt","w",stdout);
#endif

    VI a(3),b(3);
    FOR(i,0,3)
        cin>>a[i];
    FOR(i,0,3)
        cin>>b[i];
    unify(a);
    unify(b);

    if(a == b)
        printf("-1");
    else
    {
        if(a[0]!=b[0] || a[1]!=b[1])
            printf("1");
        else
            printf("0");
    }
    printf("\n");

    return 0;
}

#include <cmath>
#include <cctype>
#include <cstdio>
#include <climits>
#include <cstring>

#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

#define  D(x)             cout << #x " = " << (x) << endl;
#define  foreach(it, c)   for(typeof((c).begin()) it = (c).begin(); it!=(c).end(); ++it)
#define  foreachr(it, c)  for(typeof((c).rbegin()) it = (c).rbegin(); it!=(c).rend(); ++it)
#define  EPS              1e-9
#define  PI               acos(-1)

typedef unsigned long long int ull;
typedef long long int ll;
typedef std::stringstream ss;

inline int cmp(double x, double y=0, double tol=EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

int main() {
    //freopen("input.txt", "r", stdin);

    int A, B, C, D, E, F;
    std::cin >> A >> B >> C >> D >> E >> F;

    int det = A * E - D * B;
    if( det == 0 )
        if( A*F - C*D == 0 )
            std::cout << "-1" << std::endl;
        else
            std::cout << "0" << std::endl;
    else
        std::cout << "1" << std::endl;

    //while(1);
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    float a1,b1,c1,a2,b2,c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;
    if(a1*b2==a2*b1)
    {
      if(a1*c2==a2*c1&&b1*c2==b2*c1)
       cout<<"-1";
      else
       cout<<"0";
    }
    else
     cout<<"1";
}

#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	if(a*d==b*c&&e==f){
		cout<<"-1";
		return 0;
	}
	if(a*d==b*c&&e!=f){
		cout<<"0";
		return 0;
	}
	cout<<1;
}

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a1, a2, b1, b2, c1, c2;
	cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
	if (a1 == 0 && b1 == 0 || a2 == 0 && b2 == 0)
	{
		cout << "0";
		return 0;
	}
	if (a1 == 0 && b1 == 0 || a2 == 0 && b2 == 0)
	{
		cout << "-1";
		return 0;
	}
	if (a1 == 0 && a2 != 0||a1!=0&&a2==0)
	{
		cout << "1";
		return 0;
	}
	else
		if (a1 == 0 && a2 == 0)
			if((double)c1/b1==(double)c2/b2)
		{
				cout << "-1";
				return 0;
		}
			else
			{
				cout<<"0";
				return 0;
			}
	if (b1 == 0 && b2 != 0 || b1 != 0 && b2 == 0)
	{
		cout << "1";
		return 0;
	}
	else
		if (b1 == 0 && b2 == 0)
			if ((double)c1 / a1 == (double)c2 / a2)
			{
				cout << "-1";
				return 0;
			}
			else
			{
				cout << "0";
				return 0;
			}
	if((double)b1/a1==(double)b2/a2)
		if((double)c1/a1== (double)c2/a2)
		{
			cout << "-1";
			return 0;
		}
		else
		{
			cout << "0";
			return 0;
		}
	cout << "1";

}

// Thu Nov 24 2016 20:30:17 GMT+0300 (MSK)

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define ll long long
int gcd(int a, int b) {
	a = abs(a), b = abs(b);
	return (!a) ? b : gcd(b%a,a);
}
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a1, b1, c1, a2, b2, c2;
	cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
	int g1 = gcd(a1, gcd(b1, c1)), g2 = (a2, gcd(b2, c2));
	if(g1) a1 /= g1, b1 /= g1, c1 /= g1;
	if(g2) a2 /= g2, b2 /= g2, c2 /= g2;
	if (a1 < 0) {
		a1 = -a1;
		b1 = -b1;
		c1 = -c1;
	}
	if(a1==0){
		if (b1 < 0) {
			b1 = -b1;
			c1 = -c1;
		}
		if (b1 == 0) {
			if (c1 < 0) {
				c1 = -c1;
			}
		}
	}
	if (a2 < 0)
	{
		a2 = -a2;
		b2 = -b2;
		c2 = -c2;
	}
	if (a2 == 0) {
		if (b2 < 0) {
			b2 = -b2;
			c2 = -c2;
		}
		if (b2 == 0) {
			if (c2 < 0) {
				c2 = -c2;
			}
		}
	}
	if (a1 == a2 && b1 == b2) {
		if (c1 == c2) {
			cout << "-1";
		}
		else {
			cout << "0";
		}
	}
	else {
		cout << "1";
	}
}

// Thu Nov 24 2016 19:16:16 GMT+0300 (MSK)

#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cassert>
#include <iomanip>
#include <cmath>
using namespace std;
#define pb push_back
#define mp make_pair
int main()
{
    int a1,b1,c1,a2,b2,c2;
    cin>>a1>>b1>>c1>>a2>>b2>>c2;
    if(a1==0&&b1==0&&c1==0)
    {
        cout<<-1;
        return 0;
    }
    if(a2==0&&b2==0&&c2==0)
    {
        cout<<-1;
        return 0;
    }
    if(a1==0&&b1==0)
    {
        cout<<0;
        return 0;
    }
    if(a2==0&&b2==0)
    {
        cout<<0;
        return 0;
    }
    if(a1==0&&a2!=0)
    {
        cout<<1;
        return 0;
    }
    if(a1==0&&a2==0&&c2==0)
    {
        cout<<0;
        return 0;
    }
    if(a1==0&&b1==0&&b2==0)
    {
        if(c1==c2)
            cout<<-1;
        else
            cout<<0;
        return 0;
    }

    if((double)b1/a1==(double)b2/a2&&(double)c1/a1==(double)c2/a2)
        cout<<-1;
    else
    {
        if((double)b1/a1==(double)b2/a2)
            cout<<0;
        else
            cout<<1;
    }
	return 0;
}

/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>

#define MOD 1000000007
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

int main(){
	int a1,a2,b1,b2,c1,c2;
	cin>>a1>>b1>>c1>>a2>>b2>>c2;
	if(a1*b2==a2*b1){
		if((a1!=0&&a2!=0&&c1*a2==c2*a1)||(((a1==0&&a2==0)||(b1==0&&b2==0))&&c1==c2)||(a1==0&&b1==0&&c1==0)||(a2==0&&b2==0&&c2==0))
			cout<<-1<<endl;
		else
			cout<<0<<endl;
	}
	else
		cout<<1<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
int gcd(int a, int b){
    if(a == 0 && b == 0)
        return 1;
    if(b == 0)
        return a;
    return gcd(b,a%b);
}
void normalize(int &a, int &b, int &c){
    int g = gcd(gcd(a,b),c);
    a /= g;
    b /= g;
    c /= g;
    if(a < 0 || (a == 0 && b < 0) || (a == 0 && b == 0 && c < 0)){
        a /= -1;
        b /= -1;
        c /= -1;
    }
}
int main(){
    int a,b,c;
    int x,y,z;
    cin >> a >> b >> c >> x >> y >> z;
    normalize(a,b,c);
    normalize(x,y,z);
    if(x == a && b == y && c == z || (x == 0 && y == 0 && z == 0) || (a == 0 &&  b == 0 && c == 0))
        puts("-1");
    else if(x == a && b == y && c != z)
        puts("0");
    else
        puts("1");
}

#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

using namespace std;

struct pt {
	double x, y;
};

struct line {
	double a, b, c;
};

const double EPS = 1e-9;

double det (double a, double b, double c, double d) {
	return a * d - b * c;
}

bool intersect (line m, line n, pt & res) {
	double zn = det (m.a, m.b, n.a, n.b);
	if (abs (zn) < EPS)
		return false;
	res.x = - det (m.c, m.b, n.c, n.b) / zn;
	res.y = - det (m.a, m.c, n.a, n.c) / zn;
	return true;
}

bool parallel (line m, line n) {
	return abs (det (m.a, m.b, n.a, n.b)) < EPS;
}

bool equivalent (line m, line n) {
	return abs (det (m.a, m.b, n.a, n.b)) < EPS
		&& abs (det (m.a, m.c, n.a, n.c)) < EPS
		&& abs (det (m.b, m.c, n.b, n.c)) < EPS;
}

int main()
{
    ios_base::sync_with_stdio(0);

    int A1,B1,C1;
    int A2,B2,C2;

    cin >> A1 >> B1 >> C1;
    cin >> A2 >> B2 >> C2;

    line A, B;
    A.a = A1;
    A.b = B1;
    A.c = C1;

    B.a = A2;
    B.b = B2;
    B.c = C2;

    pt ans;

    if (A1 == 0 && B1 == 0 && C1 == 0 && A2 == 0 && B2 == 0 && C2 == 0)
    {
        cout << -1;
        return 0;
    }
    else if (A1 == 0 && B1 == 0 && C1 == 0 && A2 != 0 && B2 != 0 && C2 != 0)
    {
        cout << 0;
        return 0;
    }
    else if (A1 != 0 && B1 != 0 && C1 != 0 && A2 == 0 && B2 == 0 && C2 == 0)
    {
        cout << 0;
        return 0;
    }

    if (equivalent(A,B))
    {
        cout << -1;
        return 0;
    }

    if (intersect(A,B, ans))
    {
        cout << 1;
    }
    else
    {
        cout << 0;
    }

    return 0;
}

#include <stdio.h>
#include <cstring>
#include <math.h>
#include <string>
#include <queue>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX=10005;
const int MAX1=0x3f3f3f;
int Exgcd(int a,int b,int&x,int &y)
{
    if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    int ans=Exgcd(b,a%b,x,y);
    int temp=x;
    x=y;
    y=temp-a/b*y;
    return ans;
}
int main()
{
    int a,b,c;
    int a1,b1,c1;
    int i,j,k;
    while(~scanf("%d%d%d",&a,&b,&c))
    {

    scanf("%d%d%d",&a1,&b1,&c1);
    if(a==a1&&b==b1&&c==c1&&c1!=0)
        printf("-1\n");
    else if(c1==0)
    {
       if(a*1.0/a1==b*1.0/b1)
        printf("-1\n");
       else
        printf("1\n");
    }
    else if(a*1.0/a1==b*1.0/b1&&b*1.0/b1==c*1.0/c1)
        printf("0\n");
    else
        printf("1\n");
    }
    return 0;
}

#include <bits/stdc++.h>
//#define int long long
using namespace std;
#define IOS ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
inline int in(){int32_t x ; scanf("%d",&x) ; return x ; }
inline long long lin(){long long x ; scanf("%lld",&x) ; return x ;}
const int maxn = 100 + 10;
inline double shib(int a , int b , int c)
{
    if (b == 0 ) return 1e18;
    return -a/b;
}
int32_t main()
{
    int a1 = in() , b1 = in() , c1 = in() , a2 = in() , b2 = in() , c2 = in();
    if (b1 == 0 || b2 == 0)
    {
        if ((b1 == 0 && c1) || (b2 == 0 && c2)) return cout << 0 << endl , 0;
        if (b1 == 0 && b2 == 0 ) return cout << -1 << endl , 0;
        if (b1 ) swap(b1,b2) , swap(a1,a2),swap(c1,c2);
        if (a1)
        {
            return cout << 1 << endl  , 0;
        }
        else
        {
            return cout << -1 << endl , 0;
        }

    }
    double y1 , y2;
    y1 = (double)-c1/b1 , y2 = (double)-c2/b2;
    if (y1 == y2 && shib(a1,b1,c1) == shib(a2,b2,c2)) return cout << -1 << endl , 0;
    else if (shib(a1,b1,c1) == shib(a2,b2,c2)) return cout << 0 << endl , 0;
    cout << 1 << endl;
}

//ITNOG
#include<bits/stdc++.h>

using namespace std;
#define int long long
#define X first
#define Y second
const int maxN = 100*1000 + 5;
const int mod = 1000*1000*1000 + 7;
double dp[(1 << 18) + 2][20];
double a[20][20];
main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int a, b, c; cin >> a >> b >> c;
    int d, e, f; cin >> d >> e >> f;
    if(a * e == d * b)
    {
	  if(c == f) cout << -1 << endl;
	  else cout << 0 << endl;
	  return 0;
    }
    cout << 1 << endl;
    return 0;
}
//End