#include <bits/stdc++.h>
using namespace std;
long double pi = 3.14159265359;
const long long N = 2e5 + 5;
const long long mod = 1e9 + 7;
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b % 2) res = (res * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  res %= mod;
  return res;
}
long long a[N], b[N], dp[N];
map<pair<long long, long long>, long long> pos, neg;
long long zero;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
long long check(long long x, long long y) {
  if (x > 0 && y > 0) return 1;
  if (x < 0 && y < 0) return 1;
  if (x == 0 || y == 0) return 0;
  return -1;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    long long val = check(a[i], b[i]);
    a[i] = abs(a[i]);
    b[i] = abs(b[i]);
    if (val == 0) {
      zero++;
      continue;
    }
    long long gc = gcd(a[i], b[i]);
    a[i] /= gc;
    b[i] /= gc;
    if (val > 0)
      pos[{a[i], b[i]}]++;
    else
      neg[{a[i], b[i]}]++;
  }
  vector<pair<long long, long long>> v;
  for (auto &it : pos) {
    if (neg[{it.first.second, it.first.first}])
      v.push_back({it.second, neg[{it.first.second, it.first.first}]});
  }
  long long ans = 1;
  long long lt = 0;
  for (auto &it : v) {
    long long x = it.first;
    long long y = it.second;
    long long temp = binpow(2, x);
    temp %= mod;
    temp += binpow(2, y);
    temp %= mod;
    temp -= 1;
    temp += mod;
    temp %= mod;
    ans *= temp;
    ans %= mod;
    lt += x;
    lt += y;
  }
  lt += zero;
  lt = n - lt;
  ans *= binpow(2, lt);
  ans %= mod;
  ans *= (zero + 1);
  ans %= mod;
  ans -= 1;
  ans += mod;
  ans %= mod;
  cout << ans;
}
