#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n;
    cin >> n;
    
    map<pair<ll,ll>,P> mp;
    
    int zero = 0;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        if(x==0 && y==0){
           zero++;
           continue;
        }
        
        ll g = gcd(x,y);
        x /= g;
        y /= g;
        
        if(y<0){
            x = -x;
            y = -y;
        }
        if (y==0 && x < 0){
            x = -x;
        }
        
        bool rot90 = false;
        if(x<=0){
            rot90 =true;
        }
        
        if(rot90){
            ll tmp = x;
            x=y;
            y= -tmp;
        }
        
        if(rot90){
            mp[{x,y}].first++;  
        }else{
            mp[{x,y}].second++;
        }
        
    }
    
    ll mod = 1000000007;
    ll ans = 1;
    for(auto p:mp){
        int s = p.second.first;
        int t = p.second.second;
        ll now = 1;
        now += pow(2,s) -1;
        now = now % mod;
        now += pow(2,t) -1;
        now = now % mod;
        ans *= now;
        ans = ans % mod;
    }
    
    ans -= 1;
    ans += zero;
    cout << ans << endl;

}
