#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long mult(long long a, long long b) { return (a * b) % MOD; }
long long bpow(long long x, long long k) {
  long long ans = 1;
  while (k > 0) {
    if (k % 2 == 1) {
      ans = mult(ans, x);
      k--;
    }
    k /= 2;
    x = mult(x, x);
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b > a) {
    swap(a, b);
  }
  return (b ? gcd(b, a % b) : a);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> occ;
  for (int i = 0; i < n; i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      continue;
    }
    if (A == 0) {
      occ[{0, 1}]++;
    } else if (B == 0) {
      occ[{1, 0}]++;
    } else {
      if (B < 0) {
        A *= -1;
        B *= -1;
      }
      long long div = gcd(abs(A), abs(B));
      A /= div;
      B /= div;
      occ[{A, B}]++;
    }
  }
  vector<long long> vals;
  for (auto it : occ) {
    auto fish = it.first;
    pair<long long, long long> target = {fish.second, fish.first};
    if (target.second < 0) {
      target.first *= -1;
      target.second *= -1;
    }
    if (target.first != 0 && target.second != 0) {
      target.first *= -1;
    }
    vals.push_back((bpow(2, it.second) + bpow(2, occ[target]) - 1) % MOD);
    occ.erase(target);
  }
  long long ans = 1;
  for (auto it : vals) {
    ans = mult(ans, it);
  }
  cout << ans - 1 << '\n';
  return 0;
}
