//#include <ext/pb_ds/assoc_container.hpp> 
 //#include <ext/pb_ds/tree_policy.hpp>
// #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power(((((a)%mod)*((a)%mod))%mod),b/2)%mod;
    else return (((a)%mod)*(power(((((a)%mod)*((a)%mod))%mod),b/2)%mod))%mod;
}
inline ll inverse(ll a,ll md) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
  
  
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution
const int ce=1e9+7;
ll fast_mod(ll input)
{
    return input < ce ? input : input%ce;
}
#define pi acos(-1)
vector<pair<int,int>> temp;
int sz;
int dp[2000001];
int solve(int i)
{
    if(i==sz)
        return 1;
    int a=temp[i].first;
    int b=temp[i].second;
    int &res=dp[i];
    if(res!=-1)
        return res;
    res=0;
    res+=(power(2,a)-1+mod)%mod*solve(i+1);
    res+=(power(2,b)-1+mod)%mod*solve(i+1);
    res+=solve(i+1);
    return res;
}
int32_t main()
{
IOS

    int n;
    cin>>n;
    int c=0;
    map<pair<int,int>,int> m;
    for(int i=1;i<=n;i++)
    {
        int a,b;
        cin>>a>>b;
        if(a==0 and b==0)
        {
            c++;
            continue;
        }
        if(a==0 or b==0)
        {
            if(a==0)
            {
                m[{0,1}]++;
            }
            else
            {
                m[{1,0}]++;
            }
            continue;
        }
        int x=__gcd(abs(a),abs(b));
        a/=x;
        b/=x;
        if(a<0 and b<0)
        {
            m[{abs(a),abs(b)}]++;
            continue;
        }
        if(a>0 and b<0)
        {
             m[{-1*abs(a),abs(b)}]++;
        }
        if(a<0 and b>0)
        {
            m[{-1*abs(a),abs(b)}]++;
        }
        if(a>0 and b>0)
        {
            m[{a,b}]++;
        }
    }   
    map<pair<int,int>,int> m1;
    for(auto i:m)
    {
        if(m1.find({i.first.first,i.first.second})!=m1.end())
        {
            continue;
        }
        int a=i.first.first;
        int b=i.first.second;
        if(a==0 or b==0)
        {
            temp.push_back({i.second,m[{b,a}]});
            m1[{b,a}]=1;
            continue;
        }
        a*=-1;
        if(a*b<0)
        {
            a=abs(a);
            b*=-1;
        }
        temp.push_back({i.second,m[{b,a}]});
        m1[{b,a}]=1;
    }
    sz=temp.size();
    memset(dp,-1,sizeof(dp));
    cout<<(solve(0)-1+c+mod)%mod<<endl;
}       