#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

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

void run(){
    int n;
    cin>>n;
    int c=0;
    map<pi,int> m;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        if(!a&&!b){
            c++;
            continue;
        }
        if(!b)m[{1,0}]++;
        else {
            int g=__gcd(a,b);
            a/=g,b/=g;
            if(b<0)a*=-1,b*=-1;
            m[{a,b}]++;
        }
    }
    int ans=1;
    map<pi,bool> f;
    for(auto e:m){
        pi p=e.fi;
        if(f[p])continue;
        int a=p.fi,b=p.se;
        pi q;
        if(!a)q={0,1};
        else if(a<0)q={b,-a};
        else q={-b,a};
        int t=m[q];
        ans=ans*((((modpow(2,e.se)+modpow(2,t))%mod)-1+mod)%mod)%mod;
        f[p]=true,f[q]=true;
    }
    cout<<(ans+c-1+mod)%mod<<endl;
}