#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
map<pair<ll,ll>,int>mm;
const int maxn = 100005;
ll a[maxn],b[maxn];
ll getnum(int b){
    ll ans = 1 ;
    ll a = 2;
    while(b){
        if(b&1) ans = ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return (ans + 1000000006 )%mod;
}
int main()
{
    int n;
    cin >> n;
    ll ans = 0 ;
    for(int i=0;i<n;i++){
        cin >>a[i]>>b[i];
        if(a[i]==b[i]&&a[i]==0)
            ans++;
        else if(a[i]!=0&&b[i]!=0){
            ll gcd = __gcd(a[i],b[i]);
            a[i]=a[i]/gcd;
            b[i]=b[i]/gcd;
            mm[make_pair(a[i],b[i])]++;
        }
    }
    ll temp = 1 ;
    for(int i=0;i<n;i++){
        //cout << i << endl;
        if(a[i]==b[i]&&a[i]==0)
            continue;
        else if(a[i]==0||b[i]==0){
            temp = temp *2 % mod;
            continue;
        }
        if(mm[make_pair(a[i],b[i])]){
            if(mm[make_pair(-b[i],a[i])]+mm[make_pair(b[i],-a[i])]){
                ll d = (getnum(mm[make_pair(a[i],b[i])])+getnum(mm[make_pair(-b[i],a[i])]+mm[make_pair(b[i],-a[i])])+1) %mod;
           //     cout << d << endl;
                mm[make_pair(a[i],b[i])]=0;
                mm[make_pair(-b[i],a[i])]=0;
                mm[make_pair(b[i],-a[i])]=0;
                temp = temp *d % mod;
            }
            else
                temp = temp *2 % mod;
        }
    }
    cout << (temp +ans + 1000000006)%mod;
    return 0;
}
