#include <bits/stdc++.h>
using namespace std;
const int BIG_NUM = 1e9;
const long long INF = 1000000000000000000;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (a > b) {
    swap(a, b);
  }
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
long long pow(int k) {
  long long p = 2;
  long long a = 1;
  for (int i = 0; i < 32; i++) {
    if (((k >> i) & 1) == 1) {
      a = (a * p) % MOD;
    }
    p = (p * p) % MOD;
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, int> s;
  long long ans = 0;
  int num = n;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      num--;
      ans++;
      continue;
    }
    long long g = gcd(abs(a), abs(b));
    a /= g;
    b /= g;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (a == 0 || b == 0) {
      a = abs(a);
      b = abs(b);
    }
    s[make_pair(a, b)]++;
  }
  queue<long long> q;
  for (auto it = s.begin(); it != s.end(); it++) {
    long long a = it->first.first;
    long long b = it->first.second;
    int n0 = it->second;
    auto it1 = s.find(make_pair(-b, a));
    if (a == 0) {
      continue;
    }
    if (it1 == s.end()) {
      continue;
    }
    int n1 = it1->second;
    long long d =
        ((((pow(n0) - 1 + MOD) % MOD) * ((pow(n1) - 1 + MOD) % MOD)) % MOD);
    q.push((pow(n0 + n1) - d + MOD) % MOD);
    num -= (n1 + n0);
  }
  long long a = 1;
  while (!q.empty()) {
    a = (a * q.front()) % MOD;
    q.pop();
  }
  a = (a * pow(num)) % MOD;
  a--;
  ans = (ans + a) % MOD;
  cout << ans << endl;
}
