#include <bits/stdc++.h>
    using namespace std;
         
    #define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
    #define pb push_back
    #define ll long long
    #define ld long double
    #define vll vector<long long>
    #define infl LONG_LONG_MAX
    #define infd LDBL_MAX
    #define F first
    #define S second
    #define pll pair<ll,ll> 
    #define G(a,b) get<a>(b)
    #define ALL(v) v.begin(),v.end()
    #define MP make_pair
    #define MT make_tuple
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define fi(i,a,b) for(ll i=(b-1);i>=a;i--)    
    #define endl "\n"
    #define nl cout<<"\n";
    #define pr(x) cout<<x;
    #define pr1(x) cout<<x<<" ";
    #define pr2(x,y) cout<<x<<" "<<y;

    ll p=1000000007;
    
    ll gcd(ll a, ll b) 
    { 
        if (a == 0) 
            return b; 
        return gcd(b % a, a); 
    } 
    
    ll modpro(ll x,ll y,ll z=1)
    {
      x%=p;
      y%=p;
      z%=p;
      ll res=(x*y)%p;
      res=(res*z)%p;
      return res;
    }
     
    ll modadd(ll x,ll y,ll z=0)
    {
      x%=p;
      y%=p;
      z%=p;
      ll res=(x+y)%p;
      res=(res+z)%p;
      return res;
    }
     
     
    ll pow_mod_p(ll a,ll b)
    {
      a=a%p;
      ll res=1;
      while(b>0)
      {
        if(b&1) res=(res*a)%p;
        b=b>>1;
        a=(a*a)%p;
      }
      return res;
    }
   
    ll sgn(ll x)
    {
        if(x>0) return 1;
        else return 0;
    }
    
    void func()
    {
      ll n;
      cin>>n;

      map<pll,ll>pos,neg;
      ll cnta=0,cntb=0,err=0;

      f(i,1,n+1)
      {
        ll a,b;
        cin>>a>>b;


        if(a==0 || b==0)
        {
            if(a==0 && b==0) err++;
            else if(a!=0) cntb++;
            else if(b!=0) cnta++;
            continue;
        }

        
        
        if(sgn(a)==sgn(b)) 
        {
            a=abs(a);
            b=abs(b);
            ll g=gcd(a,b);
            a/=g;
            b/=g;
            pos[MP(a,b)]++;
        }

        else 
        {
            a=abs(a);
            b=abs(b);
            ll g=gcd(a,b);
            a/=g;
            b/=g;
            neg[MP(a,b)]++;
        }

      }
      

      ll ans=1;
      for(auto i:pos)
      {
        ll pp=i.S,qq=0;
        pll xx=i.F;
        map<pll,ll>::iterator it=neg.find(MP(xx.S,xx.F));
        if(it!=neg.end()) 
        {
            qq=it->S;
            it->S=0;
        }

        ll res=modadd(pow_mod_p(2,pp),pow_mod_p(2,qq),p-1);
        pos[i.F]=0;
        ans=modpro(ans,res); 
      }

      for(auto i:neg) 
      {
        ll res=pow_mod_p(2,i.S);
        ans=modpro(ans,res);
      }

      ll zz=modadd(pow_mod_p(2,cnta),pow_mod_p(2,cntb));
      zz=(zz-1+p)%p;
      ans=modpro(ans,zz);
      ans=modadd(ans,err);
      ans=(ans-1+p)%p;

      pr(ans) nl
      
    }   
     
     
    int main() 
    {
        fast
        //#ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        //#endif // ONLINE_JUDGE
        
     
        ll ntc=1;
        //cin>>ntc;
     
        f(i,1,ntc+1)
        {
          //cout<<"Case #"<<i<<": ";
          func();
        }
     
        return 0;
    }

Measured memory_bytes: 16004