#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
int pwr(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;
}
signed main()
{
    SPEED;
    int n;
    cin>>n;
    int a[n],b[n],z=0,cnt=0,z1=0,z2=0;
    map<pair<int,int>,int> m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        if(a[i]==0 && b[i]==0)
        {
            ++z;
            continue;
        }
        else if(a[i]==0)
        {
            ++z1;
            continue;
        }
        else if(b[i]==0)
        {
            ++z2;
            continue;
        }
        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]}]++;
    }
    cnt=pwr(2,z1)+pwr(2,z2)-1;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0 || b[i]==0 || m[{a[i],b[i]}]==0)
        {
            continue;
        }
        int chk=pwr(2,m[{a[i],b[i]}]);
        m[{a[i],b[i]}]=0;
        if(a[i]<0)
        {
            a[i]*=-1;
            b[i]*=-1;
        }
        chk+=(pwr(2,m[{-b[i],a[i]}]))-1;
        m[{-b[i],a[i]}]=0;
        chk%=MOD;
        cnt*=chk;
        cnt%=MOD;
    }
    cout<<cnt+z-1;
}