#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;
unordered_map<prl,ll> mp;
unordered_map<prl,bool> used;

ll powmod(ll px, ll py, ll pmod){
	if(py == 0) return 1;
	if(py % 2 == 0) return powmod((px * px) % pmod, py / 2, pmod);
	else return (px * powmod(px, py - 1, pmod)) % pmod;
} 

//GCD
ll mygcd(ll x, ll y){
	if( y == 0 ) return x;
	return mygcd(y, x % y);
}

int main() {
    // your code goes here
    ll n,a[200005],b[200005],g,ans=1,zs=0;
    prl mm;
    cin >> n;
    rep(i,1,n){
        cin >> a[i] >> b[i];
        g = mygcd(abs(a[i]),abs(b[i]));
        if(g!=0) a[i] /= g;
        if(g!=0) b[i] /= g;
        if(a[i]<0){
            a[i] *= -1;
            b[i] *= -1;
        }
        if(a[i]==0&&b[i]!=0) b[i]=-1;
        if(b[i]==0&&a[i]!=0) a[i]=1;
    }
    rep(i,1,n){
        if(a[i]!=0||b[i]!=0){
            mp[{a[i],b[i]}]++;
        } else zs++;
    }
    used[{0,0}]=true;
    ans=1;
    rep(i,1,n){
        if(used[{a[i],b[i]}]) continue;
        if(b[i]>=0) if(used[{b[i],-a[i]}]) continue;
        if(b[i]<0) if(used[{-b[i],a[i]}]) continue;
        if(b[i]>=0){
            ans=ans*(powmod(2,mp[{a[i],b[i]}],mod)+powmod(2,mp[{b[i],-a[i]}],mod)-1+mod)%mod;
            used[{b[i],-a[i]}]=true;
        } else {
            ans=ans*(powmod(2,mp[{a[i],b[i]}],mod)+powmod(2,mp[{-b[i],a[i]}],mod)-1+mod)%mod;
            used[{-b[i],a[i]}]=true;
        }
        used[{a[i],b[i]}]=true;
    }
    cout << (ans-1+zs+mod)%mod << endl;
    return 0;
}