#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long pw2[200005];
map<pair<long long, long long>, long long> cnt;
long long gcdd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcdd(b, a % b);
}
long long add(long long a, long long b) { return (a + b) % MOD; }
long long mul(long long a, long long b) { return (1LL * a * b) % MOD; }
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  pw2[0] = 1;
  for (int i = 1; i <= n; i++) pw2[i] = mul(pw2[i - 1], 2);
  long long res = 1, imaa = 0, imab = 0;
  for (int i = 1; i <= n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      n--;
      i--;
      continue;
    }
    if (a == 0) {
      imaa++;
      continue;
    }
    if (b == 0) {
      imab++;
      continue;
    }
    long long nzd = gcdd(abs(a), abs(b));
    a /= nzd;
    b /= nzd;
    if (a < 0 && b < 0) {
      a = -a;
      b = -b;
    }
    if (b < 0) {
      a = -a;
      b = -b;
    }
    cnt[{a, b}]++;
  }
  for (auto c : cnt) {
    if (c.second == 0) continue;
    long long a = c.first.first;
    long long b = c.first.second;
    long long a1, b1;
    if (a < 0) {
      a1 = b;
      b1 = -a;
    } else {
      a1 = -b;
      b1 = a;
    }
    long long p = cnt[{a, b}];
    long long d = cnt[{a1, b1}];
    cnt[{a, b}] = cnt[{a1, b1}] = 0;
    res = mul(res, add(1, add(pw2[p] - 1, pw2[d] - 1)));
  }
  res = mul(res, add(1, add(pw2[imaa] - 1, pw2[imab] - 1)));
  cout << add(res, MOD - 1);
  return 0;
}
