#include <bits/stdc++.h>
using namespace std;

// ref. https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a#5-%E4%BA%8C%E9%A0%85%E4%BF%82%E6%95%B0-ncr
const int MOD = 1000000007;


// a^n mod を計算する
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
      if (n & 1) res = res * a % MOD;
      a = a * a % MOD;
      n >>= 1;
  }
  return res;
}


int main(){
  int N;
  cin >> N;
  long long num_zero = 0;
  map<pair<long long, long long>, pair<long long, long long>> A;  
  for(int ii=0; ii<N; ii++){
    long long x, y;
    cin >> x >> y;
    if(x==0&&y==0){
      num_zero++;
      continue;
    }
    if(y<0){
      x = -x;
      y = -y;
    }
    long long g = gcd(abs(x), abs(y));
    x /= g;
    y /= g;
    if(x>=0){
      A[make_pair(x, y)].first++;
    }else{
      A[make_pair(y, -x)].second++;
    }
  }
  long long ans = 1;
  for(auto a : A){
    // cout << "(" << a.first.first << ", " << a.first.second << "): " << a.second.first << ", " << a.second.second << endl;
    if(a.second.first!=0&&a.second.second!=0){
      ans *= modpow(2, a.second.first) + modpow(2, a.second.second) - 1;
      ans %= MOD;
    }else{
      ans *= modpow(2, a.second.first + a.second.second);
      ans %= MOD;
    }
  }
  ans += num_zero;
  cout << (ans - 1)%MOD << endl;
  return 0;
}
