#include <bits/stdc++.h>
using namespace std;
long long gcd(long long A, long long B) {
  while (0 != B) {
    A %= B;
    swap(A, B);
  }
  return A;
}
long long lcm(long long A, long long B) {
  long long G = gcd(A, B);
  return A / G * B;
}
long long myPow(long long x, long long n) {
  long long r = 1;
  while (n > 0)
    if (0 == n % 2) {
      x *= x;
      x %= 1000000007;
      n /= 2;
    } else {
      r *= x;
      r %= 1000000007;
      n--;
    }
  return r;
}
int main() {
  long long N;
  cin >> N;
  map<string, int> PP;
  map<string, int> NN;
  long long Z = 0;
  vector<string> Key;
  for (auto i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    long long AA, BB;
    AA = abs(A);
    BB = abs(B);
    long long G = gcd(AA, BB);
    AA /= G;
    BB /= G;
    string S = to_string(AA) + '.' + to_string(BB);
    string SS = to_string(BB) + '.' + to_string(AA);
    if ((0 == A) || (0 == B))
      Z++;
    else if ((A > 0) && (B > 0)) {
      PP[S]++;
      Key.push_back(S);
    } else if ((A < 0) && (B < 0)) {
      PP[S]++;
      Key.push_back(S);
    } else {
      NN[SS]++;
      Key.push_back(SS);
    }
  }
  sort(Key.begin(), Key.end());
  long long S = myPow(2, Z);
  for (long long i = 0; i < Key.size(); i++) {
    if (i != 0)
      if (Key.at(i) == Key.at(i - 1)) continue;
    string KK = Key.at(i);
    long long SS = 0;
    SS += myPow(2, PP[KK]);
    SS += myPow(2, NN[KK]);
    SS--;
    SS %= 1000000007;
    S *= SS;
    S %= 1000000007;
  }
  S--;
  S += 1000000007;
  S %= 1000000007;
  cout << S << endl;
  return 0;
}
