#include <bits/stdc++.h>
using namespace std;
long long int pow(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int c = pow(a, b / 2);
  c = (c * c) % 1000000007;
  if (b % 2 == 1) {
    c = (c * a) % 1000000007;
  }
  return c;
}
long long int gdc(long long int a, long long int b) {
  if (a == 0) return b;
  return gdc(b % a, a);
}
pair<long long int, long long int> fract(long long int a, long long int b) {
  long long int d = 1;
  if (a * b < 0) {
    d = -1;
  }
  a = abs(a);
  b = abs(b);
  long long int c = gdc(a, b);
  return make_pair(d * a / c, b / c);
}
int main() {
  long long int n;
  cin >> n;
  map<pair<long long int, long long int>, long long int> count;
  for (long long int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    pair<long long int, long long int> inp = fract(a, b);
    count[inp]++;
  }
  long long int ans = 1;
  for (auto brr : count) {
    pair<long long int, long long int> arr, i;
    i = brr.first;
    if (i.first == 0) {
      arr = make_pair(1, 0);
    } else if (i.second == 0)
      arr = make_pair(0, 1);
    else {
      long long int sig = 1;
      if (i.first < 0) sig = -1;
      arr = make_pair(-1 * sig * i.second, abs(i.first));
    }
    long long int cnt = pow(2, brr.second) + pow(2, count[arr]) - 1;
    ans *= cnt;
    count.erase(arr);
    count.erase(i);
  }
  ans = (ans + 1000000007 - 1) % 1000000007;
  cout << ans << endl;
}
