#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int mod =1e9+7;
int power(int x,int y,int p)
{ 
    int res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if((y & 1)==1) 
            res = (res * x) % p; 
        y = y >> 1;  
        x = (x * x) % p;  
    } 
    return res; 
} 
int32_t main()
{
    IOS;
    map<pair<int,int>,int>mp;
    int n;
    cin>>n;
    int twopow[n+5]={};
    twopow[0]=1;
    for(int i=1;i<n+3;i++)
        twopow[i]=(2*twopow[i-1])%mod;
    int arr[n][2]={};
    int ans=1;
    int restans=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i][0]>>arr[i][1];
        if(arr[i][0]==0 && arr[i][1]==0)
        {
            restans++;
            continue;
        }
        int gcd = __gcd(abs(arr[i][0]),abs(arr[i][1]));
        gcd=max(gcd,1ll);
        int a=arr[i][0]/gcd;
        int b=arr[i][1]/gcd;
        if(a==0)
        {
            mp[{0,1}]++;
            continue;
        }
        if(b==0)
        {
            mp[{1,0}]++;
            continue;
        }
        if(a<0 && b<0)
            a*=-1,b*=-1;
        if(a>0 && b<0)
            a*=-1,b*=-1;
        mp[{a,b}]++;
    }
    map<pair<int,int>,int>used;
    for(auto i:mp)
    {
        if(used.find(i.first)!=used.end())
            continue;
        used[i.first]=1;
        int a=abs(i.first.first);
        int b=abs(i.first.second);
        int sign=1;
        if(i.first.first<0)
            sign=-1;
        if(mp.find({-1*sign*b,a})!=mp.end())
        {
            int val1=i.second;
            int val2=mp[{-1*sign*b,a}];
            used[{-1*sign*b,a}]=1;
            ans=(ans*((twopow[val1]+twopow[val2]-1+mod)%mod))%mod;
        }
        else
            ans=(ans*twopow[i.second])%mod;
    }
    cout<<(ans-1+restans+5*mod)%mod<<endl;
}