#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> p2(N + 1, 0);
  p2[0] = 1;
  long long cur = 1;
  for (int i = 1; i < N + 1; i++) {
    cur *= 2;
    cur %= MOD;
    p2[i] = cur;
  }
  map<pair<long long, long long>, long long> m;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    long long ta = a, tb = b;
    if (ta == 0 && tb == 0) {
      m[make_pair(0, 0)]++;
      continue;
    }
    if (ta == 0) {
      m[make_pair(0, 1)]++;
      continue;
    }
    if (tb == 0) {
      m[make_pair(1, 0)]++;
      continue;
    }
    while (ta != 0) {
      tb %= ta;
      swap(ta, tb);
    }
    a /= tb;
    b /= tb;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    m[make_pair(a, b)]++;
  }
  long long ans = 1;
  for (auto &mi : m) {
    if (mi.first.first == 0 && mi.first.second == 0) continue;
    pair<long long, long long> tmp;
    if (mi.first.second >= 0) {
      tmp.first = mi.first.second;
      tmp.second = -mi.first.first;
    } else {
      tmp.first = -mi.first.second;
      tmp.second = mi.first.first;
    }
    long long ansi = 0;
    ansi += p2[m[tmp]];
    ansi += p2[mi.second];
    ans *= ansi - 1;
    ans %= MOD;
    m[tmp] = 0;
    mi.second = 0;
  }
  cout << (ans - 1 + p2[m[make_pair((long long)0, (long long)0)]] - 1 + MOD) %
              MOD
       << endl;
  return 0;
}
