#include <bits/stdc++.h>
using namespace std;
long long n;
long long a, b;
double arr[200010];
map<double, long long> m1, m2, ch;
long long ho, he;
vector<double> vec;
long long twoo[200010];
long long ss = 1000000007;
long long ans = 1;
long long cc;
int main(void) {
  scanf("%lld", &n);
  twoo[0] = 1;
  for (long long i = 1; i < 200010; i++) twoo[i] = (twoo[i - 1] * 2) % ss;
  for (long long i = 0; i < n; i++) {
    scanf("%lld %lld", &a, &b);
    if (b == 0) {
      ho++;
      continue;
    }
    if (a == 0) {
      he++;
      continue;
    }
    arr[cc++] = (double)a / (double)b;
  }
  for (long long i = 0; i < cc; i++) {
    if (arr[i] < 0) {
      m2[-1 / arr[i]]++;
      if (ch[-1 / arr[i]] == 0) {
        vec.push_back(-1 / arr[i]);
        ch[-1 / arr[i]] = 1;
      }
    } else {
      m1[arr[i]]++;
      if (ch[arr[i]] == 0) {
        vec.push_back(arr[i]);
        ch[arr[i]] = 1;
      }
    }
  }
  for (long long i = 0; i < vec.size(); i++)
    ans = (ans * ((twoo[m1[vec[i]]] + twoo[m2[vec[i]]] - 1) % ss)) % ss;
  ans = (ans * (twoo[ho] + twoo[he] - 1) % ss) % ss;
  ans--;
  printf("%lld", ans % ss < 0 ? ans % ss + ss : ans % ss);
  return 0;
}
