#include <bits/stdc++.h>

using namespace std;


typedef long long ll;
ll mod=1e9+0LL;
ll MOD=1e18+0LL;
double pi=acos(-1);
ll md=1000000007;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    return b==0?abs(a):gcd(b,a%b);
}
ll pow(ll a ,ll n)
{
    if(n==0) return 1;
    if(n%2==0)
    {
        ll b=pow(a,n/2);
        return (b*b)%md;
    }
    return (pow(a,n-1)*a)%md;
}
int main()
{
    int cs=1;
    //scanf("%d",&cs);
    while(cs--)
    {
        ll n;
        cin>>n;
        map<pair<ll,ll>,ll>mp;
        ll zeros=0;
        for(ll i=0;i<n;i++)
        {
            ll a,b;
            cin>>a>>b;
            if(b<0)
            {
                a*=-1;
                b*=-1;
            }
            ll d=__gcd(a,b);
            if(d==0)
            {
                zeros++;
                continue;
            }
            a/=d;
            b/=d;
            mp[{a,b}]++;
        }
        ll ans=1LL;
        map<pair<ll,ll>,ll>::iterator smth;
        for(smth=mp.begin();smth!=mp.end();smth++)
        {
            pair<ll,ll> x=smth->first;
            ll amount=smth->second;
            ll tomult=pow(2,amount);
            ll a=x.first,b=x.second;
            mp[{a,b}]=0;
            swap(a,b);
            b*=-1;
            if(mp.count({a,b})>0)
                {
                    tomult+=pow(2,mp[{a,b}]);
                    tomult+=md-1;
                    tomult%=md;
                    mp[{a,b}]=0;
                }
                ans*=tomult;
                ans%=md;
        }
        ans+=md-1+zeros;
        ans%=md;
        cout<<ans;

    }
}
