#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long pow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = r * b % mod;
    p >>= 1;
    b = b * b % mod;
  }
  return r;
}
long long rev(long long a, long long b) { return a * pow(b, mod - 2) % mod; }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  map<pair<long long, long long>, long long> freq;
  long long a, b;
  long long ans = 1;
  long long add = -1;
  while (N--) {
    cin >> a >> b;
    if (!a && !b) {
      add++;
      continue;
    }
    if (!a)
      b = 1;
    else if (!b)
      a = 1;
    else {
      if (b < 0) a = -a, b = -b;
      long long c = gcd(abs(a), abs(b));
      a /= c, b /= c;
    }
    freq[{a, b}]++;
    freq[{a, b}] %= mod;
  }
  for (auto &i : freq) {
    if (!i.second) continue;
    long long a = i.first.first, b = i.first.second;
    pair<long long, long long> t;
    if (!a)
      t = {1, 0};
    else if (!b)
      t = {0, 1};
    else if (a < 0)
      t = {b, -a};
    else
      t = {-b, a};
    if ((freq.find(t) != freq.end())) {
      ans = (pow(2ll, i.second) + pow(2ll, freq[t]) - 1) % mod * ans % mod;
      freq[t] = 0;
    } else
      ans = ans * pow(2ll, i.second) % mod;
    i.second = 0;
  }
  cout << (ans + add) % mod << endl;
}
