#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int n ;
map<pair<ll,ll>,int> mop;
ll  cnt, ans=1, mod=1000000007;
ll pp(int x)
{
    if(x==0)
        return 1 ;
    return 2LL*pp(x-1)%mod;
}
void solve(ll & a, ll & b)
{
    ll g=__gcd(abs(a),abs(b));
    a/=g, b/=g;
    if(b<0)
        a*=-1, b*=-1;
    if(b==0)
        a=1;
    if(a==0)
        b=1;
}
int main()
{
    IO
    cin>>n;
    while(n--)
    {
        ll a, b;
        cin>>a>>b;
        if(a==0 && b==0)
        {
            cnt++;
            continue;
        }
        solve(a,b);
        mop[ {a,b}]++;
    }
    for(auto i : mop)
    {
        ll a, b;
        int x=i.second;
        if(x==0)
            continue;
        a=i.first.first, b=i.first.second;
        swap(a,b);
        a*=-1;
        solve(a,b);
        ans=(ans*(pp(x)+pp(mop[ {a,b}])-1))%mod;
        mop[ {a,b}]=0;
    }
    ans--;
    ans+=pp(cnt)-1;
    cout<<(ans+mod)%mod;
}
