#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto & i : (a))
#define SZ(x) ((int)(x).size())
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

const int MOD = 1000000007;

int modpow(int a, int e){
  int ret = 1;
  while(e > 0){
    if(e&1) ret = (1ll*ret*a)%MOD;
    a = 1ll*a*a%MOD;
    e>>=1;
  }
  return ret;
}

typedef std::pair<ll, ll> PLL;

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
  int n;
  std::cin >> n;
  if(n == 1){
    std::cout << 1 << "\n";
    return 0;
  }

  std::map<PLL, PII> map;

  FOR(i, n){
    ll a, b;
    std::cin >> a >> b;
    if(a == 0 && b == 0) continue;
    if(a == 0){
      map[MP(0ll, 1ll)].X++;
    }else if(b == 0){
      map[MP(0ll, 1ll)].Y++;
    }else{
      if(b < 0) a *= -1, b *= -1;
      ll gc = std::gcd(std::abs(a), std::abs(b));
      a /= gc;
      b /= gc;
      if(a < 0) map[MP(b, -a)].Y++;
      else map[MP(a, b)].X++;
    }
  }

  int ans = 1;

  TRAV(pr, map){
    int cur = 1;
    cur = (cur+modpow(2, pr.Y.X)-1)%MOD;
    cur = (cur+modpow(2, pr.Y.Y)-1)%MOD;
    if(cur < 0) cur += MOD;
    
    ans = (1ll*ans*cur)%MOD;
  }

  std::cout << (ans-1+MOD)%MOD << "\n";

	return 0;
}