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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)
#define forall(it, c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

template <typename T> inline void read(T &x) {
	x = 0; bool f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	for (;  isdigit(c); c = getchar()) x = x * 10 + (c & 15);
	if (!f) x = -x;
}

const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
int n;
ll a[maxn], b[maxn];
map <pair <ll, ll>, int> cnt;
set <vector <pair <ll, ll> > > used;
int pw[maxn];

int main() {
	rep(i, maxn) pw[i] = i ? 2LL * pw[i - 1] % mod : 1;
	read(n);
	rep(i, n) read(a[i]), read(b[i]);
	rep(i, n) {
		int g = __gcd(abs(a[i]), abs(b[i]));
		if (g) a[i] /= g, b[i] /= g;
		++ cnt[mp(a[i], b[i])];
	}
	int ans = 1;
	forall(it, cnt) {
		pair <ll, ll> p = it->first;
		if (p.first == 0 && p.second == 0) continue;
		pair <ll, ll> p1 = mp(p.second, -p.first);
		pair <ll, ll> p2 = mp(-p.second, p.first);
		pair <ll, ll> p3 = mp(-p.first, -p.second);
		vector <pair <ll, ll> > xx;
		xx.pb(p); xx.pb(p1); xx.pb(p2); xx.pb(p3);
		sort(xx.begin(), xx.end());
		if (used.find(xx) == used.end()) used.insert(xx);
		else continue;
		vector <int> v;
		if (cnt.find(p) == cnt.end()) v.pb(0); else v.pb(cnt[p]);
		if (cnt.find(p3) == cnt.end()) v.pb(0); else v.pb(cnt[p3]);
		if (cnt.find(p1) == cnt.end()) v.pb(0); else v.pb(cnt[p1]);
		if (cnt.find(p2) == cnt.end()) v.pb(0); else v.pb(cnt[p2]);
		int tot = 0;
		rep(mask, 1 << 4) {
			bool ok = 1;
			rep(a, 2) rep(b, 2)
				ok &= !((mask >> a & 1) && (mask >> (b | 2) & 1));
			if (ok) {
				int cur = 1;
				rep(x, 4) if (mask >> x & 1) {
					cur = 1LL * (pw[v[x]] + mod - 1) * cur % mod;
				}
				(tot += cur) %= mod;
			}
		}
		ans = 1LL * ans * tot % mod;
	}
	if (cnt[mp(0, 0)]) (ans = ans + 1) %= mod;
	printf("%d\n", (ans + mod - 1) % mod);
	return 0;
}
