#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9+7;
ll pm(int n,int p){
    ll ret = 1;
    ll now = n;
    while(p){
        if(p & 1){
            ret *= now;
            ret %= mod;
        }
        now *= now;
        now %= mod;
        p >>= 1;
    }
    return ret;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	map<pair<ll,ll>,pair<int,int>>mp;
	int c0 = 0;
	f (n) {
		ll x, y;
		cin >> x >> y;
		if (b < 0) {
			a = -a;
			b = -b;
		}
		if (x == 0 && y == 0) {
			c0++;
		}
		else {
			ll g = __gcd(x, y);
			x /= g;
			y /= g;
			if (x <= 0) {
				mp[{y, -x}].S++;
			}
			else {
				mp[{x, y}].F++;
			}
		}
	}
	ll ans = 1;
	for (auto &i : mp) {
		ll add = (pm(2, i.S.F) + pm(2, i.S.S) - 1 + mod) % mod;
		ans *= add;
		ans %= mod;
	}
	ans += mod - 1 + c0;
	ans %= mod;
	cout << ans << '\n';
}
