#include <bits/stdc++.h>
using namespace std;
int n, zero;
long long a, b, ans = 1;
map<pair<long long, long long>, pair<int, int> > table;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  if (b == 0) return a;
  long long c = a % b;
  while (c) {
    c = a % b;
    a = b;
    b = c;
  }
  return b;
}
long long quickpow(long long x, long long y, long long mod) {
  long long ans = 1;
  while (y) {
    if (y % 2 == 1) ans = (ans * x) % mod;
    y /= 2;
    x = (x * x) % mod;
  }
  return ans;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a < 0 && b < 0) {
      a = -a, b = -b;
    }
    long long temp = gcd(a, b);
    a /= temp;
    b /= temp;
    if (b < 0) {
      a = -a;
      b = -b;
    }
    if (a < 0)
      table[make_pair(b, -a)].first++;
    else
      table[make_pair(a, b)].second++;
  }
  for (auto p : table) {
    int i = p.second.first;
    int j = p.second.second;
    long long temp = quickpow(2, i, MOD) + quickpow(2, j, MOD) - 1;
    ans = (ans * temp) % MOD;
    ans %= MOD;
  }
  cout << (ans + zero - 1 + MOD) % MOD;
  return 0;
}
