#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, a, b;
    cin >> n;
    map<pair<ll, ll>, ll > mp, mp1;
    while(n--){
    	cin >> a >> b;
    	if(a != 0LL){
    		if(b != 0LL){
    			bool maki = false;
    			if(b < 0) maki ^= 1, b = -b;
    		    if(a < 0) maki ^= 1, a = -a;
    		    ll g = gcd(a, b);
    		    a /= g; b /= g;
    		    if(maki) mp[{-a, b}]++;
    		    else mp[{a, b}]++;
    		}else mp[{0, 1}]++;
    	}else if(b != 0LL) mp[{-1, 0}]++;
    }
    ll ans = 1;
    for(auto& i: mp){
    	a = i.first.first;
    	b = i.first.second;
    	ll c, d;
    	if(a < 0){
    		c = b;
    		d = -a;
    	}else{
    		c = -b;
    		d = a;
    	}
    	ll num = (modpow(2LL, mp[{c, d}]) + modpow(2LL, i.second)) % mod - 1;
    	num %= mod;
    	ans *= num;
    	ans %= mod;
    	mp[{c, d}] = 0;
    	mp[{a, b}] = 0;
    }
    ans--;
    ans %= mod;
    ans += mod;
    ans %= mod;
    cout << ans << endl;
    return 0;
}
