#include <bits/stdc++.h>
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int ndx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int ndy[8] = {1, 0, -1, 0, 1, -1, -1, 1};
double pi = 3.141592653589793;
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
long long PowMod(long long a, long long b) {
  if (b == 1) return a % 1000000007;
  if (b == 0) return 1;
  long long d = (long long)PowMod(a, b / 2);
  long long c = (d * d) % 1000000007;
  if (b % 2 == 0) {
    return c;
  } else {
    return (c * a) % 1000000007;
  }
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  map<pair<long long, long long>, int> m, used;
  int c0 = 0;
  int a0 = 0;
  int b0 = 0;
  for (int i = 0; i < n; i++) {
    long long x = a[i];
    long long y = b[i];
    if (x == 0 && y == 0) {
      c0++;
    } else if (x == 0) {
      a0++;
    } else if (y == 0) {
      b0++;
    } else {
      bool minas = (x < 0 && y > 0) || (x > 0 && y < 0);
      x = abs(x);
      y = abs(y);
      long long g = gcd(x, y);
      x /= g;
      y /= g;
      if (minas) {
        x *= -1;
      }
      m[make_pair(x, y)]++;
    }
  }
  long long ans = 1;
  for (auto it = m.begin(); it != m.end(); it++) {
    auto index = it->first;
    auto value = it->second;
    long long x = index.first;
    long long y = index.second;
    long long x2 = y;
    long long y2 = x;
    if (x < 0) {
      y2 *= -1;
    } else {
      x2 *= -1;
    }
    long long zans = 0;
    ;
    if (used[index] == 0) {
      used[index] = 1;
      if (value > 0) zans += PowMod(2, value);
      zans %= 1000000007;
      auto value2 = m[make_pair(x2, y2)];
      used[make_pair(x2, y2)] = 1;
      if (value2 > 0) zans += PowMod(2, value2);
      zans %= 1000000007;
      if (value > 0 && value2 > 0) zans--;
      ans *= zans;
      ans %= 1000000007;
    }
  }
  long long zans = 0;
  ;
  if (a0 > 0) zans += PowMod(2, a0);
  zans %= 1000000007;
  if (b0 > 0) zans += PowMod(2, b0);
  zans %= 1000000007;
  if (a0 > 0 && b0 > 0) zans--;
  if (zans) {
    ans *= zans;
    ans %= 1000000007;
  }
  ans += (c0);
  ans %= 1000000007;
  ans--;
  ans %= 1000000007;
  cout << ans << endl;
}
