#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define REV(x) reverse(x.begin(),x.end())
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
const ll MOD=1000000007;
const int mxN=2e5+5;
int n;
map<pair<ll,ll>,int> cnt;

ll mul(ll a,ll b) {
    a=(a%MOD+MOD)%MOD;
    b=(b%MOD+MOD)%MOD;
    return (a*b)%MOD;
}

ll modpow(ll a,ll b) {
    a=(a%MOD+MOD)%MOD;
    if(!b)
        return 1;
    ll res=modpow(a,b/2);
    if(b%2)
        return mul(a,mul(res,res));
    return mul(res,res);
}

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;
    F0R(i,n) {
        ll a,b;
        cin >> a >> b;
        ll gcd=__gcd(a,b);
        a/=gcd;
        b/=gcd;
        if(a<0) {
            a*=-1;
            b*=-1;
        }
        cnt[{a,b}]++;
    }
    set<pair<int,int>> groups;
    ll su=0; 
    set<pair<ll,ll>> vis;
    for(auto p : cnt) {
        if(vis.find(p.first)!=vis.end())
            continue;
        pair<ll,ll> rat=p.first;
        pair<ll,ll> irat={-p.first.second,p.first.first};
        if(irat.first<0) {
            irat.first*=-1;
            irat.second*=-1;
        }
        vis.insert(rat);
        vis.insert(irat);
        if(cnt.find(irat)==cnt.end())
            continue;
        groups.insert({cnt[rat],cnt[irat]});
        su+=cnt[rat]+cnt[irat];
    }
    ll tot=modpow(2,n-su);
    for(auto p : groups)
        tot=mul(tot,modpow(2,p.first)+modpow(2,p.second)-1);
    cout << tot-1;

    return 0;
}
