#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define INF 1e18
#define pi 3.14159265358979323846264338327950
typedef pair<int,int> pr;
#define N 1000002
int power(int x,int p)
{
   int temp=1;
   while(p>0)
   {
       if(p%2)
       {
           temp*=x;
           temp%=MOD;
           --p;
       }
       else
       {
           x*=x;
           x%=MOD;
           p/=2;
       }
   }
   return temp%MOD;
}
signed main()
{
    SPEED;
    int n,ans=0,p1=0,p2=0,p=0;
    cin>>n;
    set<pr> s;
    map<pr,int> m;
    int a[n],b[n];
    for(int i=0;i<n;++i)
    {
        cin>>a[i]>>b[i];
        if(a[i]==0 && b[i]==0)
            p++;
        else if(a[i]==0)
            p1++;
        else if(b[i]==0)
            p2++;
        else
        {
            int g=__gcd(a[i],b[i]);
            a[i]/=g;
            b[i]/=g;
            if(b[i]<0)
            {
                a[i]*=-1;
                b[i]*=-1;
            }
            m[{a[i],b[i]}]++;
        }
    }
    ans+=(power(2,p1)-1+power(2,p2));
    for(int i=0;i<n;++i)
    {
        if(a[i]==0 || b[i]==0 || m[{a[i],b[i]}]==0)
            continue;
        int chk=power(2,m[{a[i],b[i]}]);
        m[pr(a[i],b[i])]=0;
        if(a[i]<0)
        {
            a[i]*=-1;
            b[i]*=-1;
        }
        chk+=power(2,m[{-b[i],a[i]}])-1;
        chk%=MOD;
        m[pr(-b[i],a[i])]=0;
        ans*=chk;
        ans%=MOD;
    }
    cout<<ans-1+p;
}