// In the name of God

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;
const int mod = 1e9+7;

using ll = long long;

pair<ll, ll> a[N];
ll ans;
int n;

ll fast_pw(ll x, ll y) {
	x %= mod;
	ll ret = 1;

	for(;y;y>>=1) {
		if(y&1) ret = (ret * x) % mod;
		x = (x*x) % mod;
	}
	return ret;
}

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

	int t1 = 0, t2 = 0;

	for(int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;

		if(a[i].first == 0 && a[i].second) t1++;
		if(a[i].second == 0 && a[i].first) t2++;
	}

	map<pair<ll,ll>, int> neg, pos;

	for(int i = 0; i < n; i++) {

		if(a[i].first == 0 || a[i].second == 0) continue;

		bool f = true;
		pair<ll,ll> now = a[i];
		
		if( (now.first < 0) != (now.second < 0) ) f = false;

		now.first = abs(now.first);
		now.second = abs(now.second);

		ll g = __gcd(now.first, now.second);

		now.first /= g;
		now.second /= g;

		if(f) {
			pos[now]++;
		}
		else {
			neg[now]++;
		}

	}

	vector<pair<int,int>> vp;

	for(auto &x : pos) {
		vp.emplace_back(x.second, neg[make_pair(x.first.second, x.first.first)]);
	}

	for(auto &x : neg) {
		if(pos.find(make_pair(x.first.second, x.first.first)) != pos.end()) continue;
		
		vp.emplace_back(x.second, 0);

	}

	if(t1 || t2) vp.emplace_back(t1, t2);

	ans = 1;

	for(auto &p : vp) {
		ll x = ans * ((fast_pw(2, p.first) - 1 + mod ) % mod + (fast_pw(2, p.second) - 1 + mod) % mod  ) % mod;
		x %= mod;
		ans = (ans + x) % mod;
	}

	cout << (ans - 1 + mod) % mod;

	
	return 0;
}
