#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 ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 2e5 + 123, MOD = 1e9 + 7;
const pii mod = {1e9 + 7, 1e9 + 9};
int n;
pii s[N];

int bp(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = (ll)res * x % m;
		}
		x = (ll)x * x % m;
		y /= 2;
	}
	return res;
}

pii norm(ll x) {
	pii res;
	if (x < 0) {
		res.F = (-((-x) % mod.F) + mod.F) % mod.F;
		res.S = (-((-x) % mod.S) + mod.S) % mod.S;
	}	else {
		res.F = x % mod.F;
		res.S = x % mod.S;
	}
	return res;
}

pii inv(pii num) {
	return {bp(num.F, mod.F - 2, mod.F), bp(num.S, mod.S - 2, mod.S)};
}

int cnt;
pii a[N], r[N];
map <pii, bool> used;
map <pii, int> ind, w;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	pii X, Y;
	for (int i = 1; i <= n; i++) {
		ll x, y;
		cin >> x >> y;
		X = norm(x), Y = norm(y);
		X = inv(X);
		Y.F = (ll)Y.F * X.F % mod.F;
		Y.S = (ll)Y.S * X.S % mod.S;
		s[i] = Y;
	}
	for (int i = 1; i <= n; i++) {
		if (used.count(s[i])) {
			w[s[i]] = w[s[i]] * 2 % MOD;
			continue;
		}
		used[s[i]] = true;
		a[++cnt] = s[i];
		w[s[i]] = 2;
	}
	int ans = 1;
	for (int i = 1; i <= cnt; i++) {
		pii t = inv(a[i]);
		r[i] = {(-t.F + mod.F) % mod.F, (-t.S + mod.S) % mod.S};
		
		if (ind.count(r[i])) {
			int j = ind[r[i]];
			int W1 = w[a[i]], W2 = w[a[j]];
			int res = (ll)W1 * W2 % MOD;
			res -= (ll)(W1 - 1) * (W2 - 1) % MOD;
			if (res < 0) {
				res += MOD;
			}
			ans = (ll)ans * res % MOD;
			ans = (ll)ans * bp(W2, MOD - 2, MOD) % MOD;
		}	else {
			ans = (ll)ans * w[a[i]] % MOD;
		}
		ind[a[i]] = i;
	}
	cout << (ans - 1 + MOD) % MOD;
}
