#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 200005;
const int MOD = 1000000007;
pair<long long int, long long int> bul[N_MAX];
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int MOD_pow(long long int n) {
  int x = 2;
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
map<pair<long long int, long long int>, int> S;
set<pair<long long int, long long int>> CHECK;
vector<pair<int, int>> ANS;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    long long int c = gcd(abs(a), abs(b));
    a = a / c;
    b = b / c;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    bul[i] = make_pair(a, b);
    pair<long long int, long long int> n = make_pair(a, b);
    if (S.find(n) == S.end())
      S.insert(make_pair(n, 1));
    else
      S[n]++;
  }
  for (int i = 0; i < n; i++) {
    if (CHECK.find(bul[i]) != CHECK.end()) continue;
    long long int a = bul[i].first;
    long long int b = bul[i].second;
    int l = S[bul[i]];
    long long int c = b, d = -a;
    if (c < 0) {
      c *= -1;
      d *= -1;
    }
    int t;
    pair<long long int, long long int> cd = make_pair(c, d);
    if (S.find(cd) == S.end())
      t = 0;
    else
      t = S[cd];
    CHECK.insert(bul[i]);
    CHECK.insert(cd);
    ANS.emplace_back(l, t);
  }
  long long int pat = 1;
  for (int i = 0; i < ANS.size(); i++) {
    int l = ANS[i].first;
    int t = ANS[i].second;
    if (t == 0)
      pat *= MOD_pow(l);
    else
      pat *= (MOD_pow(l) + MOD_pow(t) - 1);
    pat %= MOD;
  }
  pat += MOD - 1;
  pat %= MOD;
  cout << pat << endl;
  return 0;
}
