#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vb = vector<bool>;
using vvb = vector<vb>;
const long long int MOD = 1e9 + 7;
const double pi = 3.14159265358979323846264338327950288;
vi alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
               'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
long long int gcd(long long int a, long long int b) {
  if (a == 0 && b != 0)
    return (b);
  else if (a != 0 && b == 0)
    return (a);
  else if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
int main() {
  int N;
  cin >> N;
  vll A(N);
  vll B(N);
  for (long long int i = 0; i < N; i++) {
    cin >> A[i];
    cin >> B[i];
  }
  int ex1 = 0;
  int ex2 = 0;
  int ex3 = 0;
  map<vll, int> gr;
  for (long long int i = 0; i < N; i++) {
    if (A[i] == 0 && B[i] == 0)
      ex1++;
    else if (A[i] == 0 && B[i] != 0)
      ex2++;
    else if (A[i] != 0 && B[i] == 0)
      ex3++;
    else {
      long long int g = gcd(A[i], B[i]);
      A[i] /= g;
      B[i] /= g;
      vll v = {A[i], B[i]};
      vll u = {-B[i], A[i]};
      vll w = {B[i], -A[i]};
      if (gr.count(u) || gr.count(w)) {
        gr[u]++;
        gr[w]++;
      } else
        gr[v] = 1;
    }
  }
  long long int ans = 0;
  long long int k = ex2;
  for (pair<vll, int> p : gr) {
    long long int v = p.second;
    k *= v + 1;
    k %= MOD;
  }
  ans += k;
  k = ex3;
  for (pair<vll, int> p : gr) {
    long long int v = p.second;
    k *= v + 1;
    k %= MOD;
  }
  ans += k;
  k = 1;
  for (pair<vll, int> p : gr) {
    long long int v = p.second;
    k *= v + 1;
    k %= MOD;
  }
  k -= 1;
  ans += k;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
}
