#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000007;
const ll inv2 = (mod + 1) / 2;
int n;
ll a, b;
ll c0, ans = 1;
typedef pair<ll, ll>pii;
map<pii, pii>mp;
ll Pow(ll a, ll b) {
	ll res = 1ll;
	while (b) {
		if (b & 1)res = res * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return res;
}
int main() {
	cout << gcd(4, 0) << endl;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld%lld", &a, &b);
		if (a == 0 && b == 0)c0++;
		else {
			if (b < 0)a = -a, b = -b;
			ll g = abs(gcd(a, b));
			a /= g; b /= g;
			if (a > 0)mp[pii(a, b)].first++;
			else mp[pii(b, -a)].second++;
		}
	}
	for (auto p : mp) {
		ll tmp = (Pow(2, p.second.first) + Pow(2, p.second.second) + mod - 1) % mod;
		ans = ans * tmp%mod;
	}
	printf("%lld\n", (ans + mod - 1 + c0) % mod);
	return 0;
}