#define _USE_MATH_DEFINES 1
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007ll
#define INF 1000000000000000000ll
#define EPS 1e-9
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock

typedef long long         ll;
typedef long double       ld;
typedef pair <ll,ll>      pl;
typedef tuple <ll,ll,ll>  tl;

ll T, N, P2[200005], A[200005], B[200005], Z, S;
map <tl,pl> mm;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	T = 1;
	
	P2[0] = 1;
	for (ll i = 1; i <= 200000; i++) {
		P2[i] = 2 * P2[i-1];
		while (P2[i] >= MOD) P2[i] -= MOD;
	}
	
	for (ll q = 0; q < T; q++) {
		
		cin >> N;
		Z = 0;
		
		for (ll i = 1; i <= N; i++) {
			cin >> A[i] >> B[i];
			if (A[i] == 0 || B[i] == 0) Z++;
			else if ((A[i] > 0) == (B[i] > 0)) {
				A[i] = abs(A[i]);
				B[i] = abs(B[i]);
				ll g = __gcd(A[i], B[i]);
				A[i] /= g;
				B[i] /= g;
				ll q = A[i] / B[i];
				ll d = B[i];
				ll r = A[i] % B[i];
				tl unit = tie(q, d, r);
				if (mm.find(unit) == mm.end()) mm[unit] = make_pair(0ll, 0ll);
				mm[unit].first++;
			} else {
				A[i] = abs(A[i]);
				B[i] = abs(B[i]);
				ll g = __gcd(A[i], B[i]);
				A[i] /= g;
				B[i] /= g;
				ll q = B[i] / A[i];
				ll d = A[i];
				ll r = B[i] % A[i];
				tl unit = tie(q, d, r);
				if (mm.find(unit) == mm.end()) mm[unit] = make_pair(0ll, 0ll);
				mm[unit].second++;
			}
		}
		
		S = Z + 1;
		
		for (auto& kv : mm) {
			ll pos = (kv.second).first;
			ll neg = (kv.second).second;
			S = (S * (P2[pos] + P2[neg] - 1)) % MOD;
		}
		
		cout << (S - 1 + MOD) % MOD << "\n";
		
	}
		
    return 0;
}