#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

ll gcd(ll a,ll b){
    if(a<b)return gcd(b,a);
    if(b==0)return a;
    return gcd(b,a%b);
}

ll mod = 1000000007;

ll modpow(ll a,ll b){
    if(b==0)return 1;
    if(b%2==0){
        ll d =modpow(a,b/2);
        return d*d%mod;
    }
    return a*modpow(a,b-1)%mod;
}

ll divide(ll a,ll b){
    return a*modpow(b,mod-2)%mod;
}

int main(){
    int n=in();
    vector<pll> a(n);
    rep(i,n){
        a[i]=mp(lin(),lin());
    }
    map<pll,ll> m;
    rep(i,n){
        ll x=a[i].first;
        ll y=a[i].second;
        ll g=gcd(abs(x),abs(y));
        if(g>0){
            x/=g;
            y/=g;
        }
        if(x<0){
            x=-x;
            y=-y;
        }
        m[mp(x,y)]++;
    }
    ll cnt0=m[mp(0,0)];
    m.erase(mp(0,0));
    ll ans=1;
    auto itr = m.begin();
    while(itr != m.end()){
        ll x = itr->first.first;
        ll y = itr->first.second;
        ll c = itr->second;
        ll d = 0;
        if(y < 0 && m.find(mp(-y,x))!=end(m)){
            d=m[mp(-y,x)];
        }else if(y >= 0 && m.find(mp(y,-x))!=end(m)){
            d=m[mp(y,-x)];
        }
        ans = ans*((modpow(2,c)+modpow(2,d)-1)%mod)%mod;
        m.erase(mp(x,y));
        if(y < 0 && m.find(mp(-y,x))!=end(m)){
            m.erase(mp(-y,x));
        }else if(y >= 0 && m.find(mp(y,-x))!=end(m)){
            m.erase(mp(y,-x));
        }
        itr++;
    }
    cout<<(ans+cnt0+mod-1)%mod<<endl;
}