#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define endl "\n"
ll const M = 1000000007;
dd const pi = acos(-1);
ll const inf = 2e18;
ll const N = 200001;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<ll> a(N),b(N);
ll n;
ll power(ll a,ll b)
{
    ll res = 1;
    while(b > 0)
    {
        if(b & 1)
            res = (res*a)%M;
        a = (a*a)%M;
        b = b >> 1;
    }
    return res;
}
ll modinv(ll a)
{
   return power(a,M - 2); 
}  
void reduce(ll x,ll y,ll index)
{
  if(y == 0)
  {
    a[index] = 1;
    return;
  }
  if(x == 0)
  {
    b[index] = 1;
    return;
  }
  if(x < 0 && y < 0)
    a[index] = abs(x),b[index] = abs(y);
  if(x > 0 && y < 0)
    a[index] = -x,b[index] = -y;
  ll g = __gcd(abs(x),abs(y));
  a[index] /= g,b[index] /= g;
  return;
}
int main()
{
    fast;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    unsigned long long i,j,t,cnt = 0,ans = 1;
    cin >> n;
    for(i = 1; i <= n; i++)
      cin >> a[i] >> b[i];
    map<pair<ll,ll>,ll> sum;
    for(i = 1; i <= n; i++)
    {
      if(a[i] == 0 && b[i] == 0)
        cnt++;
      else
      {
        reduce(a[i],b[i],i);
        sum[{a[i],b[i]}]++;
      }
    }
    map<pair<ll,ll>,bool> visited;
    for(i = 1; i <= n; i++)
    {
      if((a[i] != 0 && b[i] != 0) && !visited[{a[i],b[i]}])
      {
        ll s1 = 0,s2 = 0;
        s1 = sum[{a[i],b[i]}];
        if(a[i] > 0)
        {
          s2 = sum[{-b[i],a[i]}];
          visited[{-b[i],a[i]}] = true;
        }
        else
        {
          s2 = sum[{b[i],-a[i]}];
          visited[{b[i],-a[i]}] = true;
        }
        ans = (ans*(power(2,s1) + power(2,s2) - 1)%M)%M;
        visited[{a[i],b[i]}] = true;
      }
    }
    cout<<(ans + cnt - 1)%M<<endl;
    return 0;
}    