#include <bits/stdc++.h>
using namespace std;
long long int mpow(long long int a, long long int b, long long int p = -1) {
  long long int ret = 1, num = a;
  if (p == -1) {
    while (b > 0) {
      if (b % 2) ret *= num;
      num = num * num;
      b /= 2;
    }
  } else {
    while (b > 0) {
      if (b % 2) ret = (ret * num) % p;
      num = (num * num) % p;
      b /= 2;
    }
  }
  return ret;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (b < a) swap(a, b);
  long long int r = a % b;
  if (r == 0) return b;
  while (r != 0) r = a % b, a = b, b = r;
  return a;
}
int main(int argc, char const *argv[]) {
  long long int n;
  std::cin >> n;
  map<vector<long long int>, long long int> mp;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    scanf("%lld %lld", &a, &b);
    if (a == 0 && b == 0) continue;
    long long int g = gcd(abs(a), abs(b));
    a /= g, b /= g;
    vector<long long int> A = vector<long long int>{a, b};
    vector<long long int> B = vector<long long int>{-b, a};
    vector<long long int> C = vector<long long int>{-a, -b};
    vector<long long int> D = vector<long long int>{b, -a};
    if (mp.find(A) == mp.end()) mp.emplace(A, 0);
    if (mp.find(B) == mp.end()) mp.emplace(B, 0);
    if (mp.find(C) == mp.end()) mp.emplace(C, 0);
    if (mp.find(D) == mp.end()) mp.emplace(D, 0);
    auto itr = mp.find(A);
    (*itr).second++;
  }
  long long int ans = 1;
  for (auto now : mp) {
    vector<long long int> tmp = now.first;
    if (tmp[0] <= 0 || tmp[1] < 0) continue;
    long long int a = mp.at(tmp);
    long long int b = mp.at(vector<long long int>{-tmp[1], tmp[0]});
    long long int c = mp.at(vector<long long int>{-tmp[0], -tmp[1]});
    long long int d = mp.at(vector<long long int>{tmp[1], -tmp[0]});
    long long int f =
        (mpow(2, a + c, 1000000007) - 1 + 1000000007) % 1000000007;
    long long int g =
        (mpow(2, b + d, 1000000007) - 1 + 1000000007) % 1000000007;
    long long int x = (1 + f + g) % 1000000007;
    ans = (ans * x) % 1000000007;
  }
  std::cout << (ans - 1 + 1000000007) % 1000000007 << '\n';
  return 0;
}
