#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.second < b.second);
}
long long maxSubArraySum(long long a[], long long size) {
  long long max_so_far = INT_MIN, max_ending_here = 0;
  for (long long i = 0; i < size; i++) {
    max_ending_here = max_ending_here + a[i];
    if (max_so_far < max_ending_here) max_so_far = max_ending_here;
    if (max_ending_here < 0) max_ending_here = 0;
  }
  return max_so_far;
}
long long findSubarraySum(long long arr[], long long n, long long sum = 0) {
  unordered_map<long long, long long> prevSum;
  long long res = 0;
  long long currsum = 0;
  for (long long i = 0; i < n; i++) {
    currsum += arr[i];
    if (currsum == sum) res++;
    if (prevSum.find(currsum - sum) != prevSum.end())
      res += (prevSum[currsum - sum]);
    prevSum[currsum]++;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long powmp(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  long long M = 1e9 + 7;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  map<long double, long long> count;
  vector<pair<long double, long double>> v;
  long double infl = LLONG_MAX;
  for (long long i = 0; i < n; i++) {
    long double a, b;
    cin >> a >> b;
    if (a != 0 && b != 0) {
      v.push_back({a, b});
      count[a / b]++;
    } else if (b == 0 && a != 0) {
      v.push_back({infl, 1});
      count[infl]++;
    } else if (a == 0 && b != 0) {
      v.push_back({a, b});
      count[0]++;
    }
  }
  long long ans = 1;
  for (long long i = 0; i < n; i++) {
    long double a = v[i].first, b = v[i].second;
    long long x, y;
    if (a == 0) {
      x = count[0];
      y = count[infl];
      count[infl] = 0;
      count[0] = 0;
    } else if (b == 0) {
      y = count[0];
      x = count[infl];
      count[infl] = 0;
      count[0] = 0;
    } else {
      x = count[a / b];
      y = count[-b / a];
      count[a / b] = 0;
      count[-b / a] = 0;
    }
    long long curr = 0;
    if (x != 0) curr = (curr + powmp(2, x, M)) % M;
    if (y != 0) curr = (curr + powmp(2, y, M)) % M;
    if (x != 0 && y != 0) curr -= 1;
    if (curr != 0) ans = (ans * curr) % M;
  }
  ans -= 1;
  cout << ans << "\n";
}
