#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
typedef long long int ll;
const ll N = 1e6;
// const ll m = 1e9 + 7;
// const ll inf= 1e14;
const ll mod =1e9 + 7;
const ll INF = 1e14;
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define pld pair<ld,ld>
#define pii pair<ll, ll>
#define ld long double
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }


int main() {   
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt","w",stderr);
    #endif
    ll t = 1;
    // cin>>t; 
    while(t--){
        map<pii,pii> ct;
        set<pii> rs;
        ll n;cin>>n;
        ll ze = 0;
        for(int i = 0;i<n;i++){
            ll a,b;cin>>a>>b;
            if(a==0&& b==0){
                ze++;
                continue;
            }
            ll gc = __gcd(a,b);
            a/=gc;
            b/=gc;
            if(b==0){
                a = 1;
            }
            if(a==0){
                b = 1;
            }
            if(b<0){
                a*=-1;
                b*=-1;
            }
            if(a>=0)
                ct[mp(a,b)].x++;
            else ct[mp(b,-a)].y++;
        }

        ll ans = 1;
        for(auto i:ct){
            // cout<<i.x.x<<" "<<i.x.y<<'\n';
            ll te = (powm(2,i.y.x) + powm(2,i.y.y))%mod -1 ;

            // cout<<i.y.x<<" "<<i.y.y<<"\n\n";
            te+=mod;
            te%=mod;
            ans*=te;
            ans%=mod;
        }
        ans+=ze;
        ans%=mod;
        ans--;
        ans = ans+mod;
        ans%=mod;
        cout<<ans<<'\n';
    }
}              