#include <bits/stdc++.h>
#define watch(x) cerr << (#x) << " is " << (x) << endl;
using namespace std;
const int MAXN = 200001;
const int INF = 1234567890;
const int MOD = (int)(1e9 + 7);
using ll = long long;
using pll = pair<ll, ll>; //numerator is always negative
using pii = pair<int, int>;

int n, zero;
ll a, b;

map<pll, pii> ratings;

template <typename T> int sgn(T val){
	return (T(0) < val) - (val < T(0));
}

ll modpow(int a, int x){
	ll ans = 1; n = a;
	while(x){
		if (x & 1){
			ans *= n; ans %= MOD;
		}
		n *= n; n %= MOD; x /= 2;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n;
	for (int i = 0; i < n; ++i){
		cin >> a >> b;
		if (a == 0 and b == 0){
			zero++;
		}
		int neg = sgn(a) * sgn(b);
		ll num = sgn(a) * a, denom = sgn(b) * b;
		ll g = gcd(num, denom);
		num /= g; denom /= g;
		num *= neg;
		pll f{num, denom}, r{-1 * neg * denom, abs(num)};
		if (ratings.count(r) == 0){
			ratings[f].first++;
		}
		else{
			ratings[r].second++;
		}
	}
	ll ans = 1;
	for (auto data : ratings){
		//cout << data.first.first << ' ' << data.first.second << endl;
		//cout << "frequencies: " << data.second.first << ' ' << data.second.second << endl;
		int s = data.second.first;
		int t = data.second.second;
		ll part = (modpow(2, s) - 1) + (modpow(2, t) - 1) + 1;
		part %= MOD;
		ans *= part; ans %= MOD;
	}
	if (ans == 0) ans = MOD - 1;
	else ans--;
	ans += zero; ans %= MOD;
	cout << ans << endl;
	return 0;
}
