#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 1e9 + 7;

long long pwr(long long a, long long b, long long m = M) {
  long long ret = 1;

  while (b > 0) {
    if (b & 1)  ret = ret * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return ret;
}

int32_t main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);

  int n;
  cin >> n;
  
  int bo = 0, l = 0, r = 0;
  map<pair<int, int>, int> m;

  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    if (!a && !b) ++bo;
    else if (!a) ++l;
    else if (!b) ++r;
    else {
      if (a < 0) a *= -1, b *= -1;
      int g = abs(__gcd(a, b));
      m[{a/g, b/g}]++;
    }
  }
  
  int ans = (bo + 1);
  ans = ans * (pwr(2, l) + pwr(2, r) + M - 1) % M;

  for (auto s : m) {
    int a = s.first.first, b = s.first.second, na = abs(b), nb = a;
    if (b > 0) nb *= -1;
    if (m.count({na, nb})) {
      if (b > 0) ans = ans * (pwr(2, m[{a,b}]) + pwr(2, m[{na,nb}]) + M - 1) % M;
    } else ans = ans * pwr(2, m[{a, b}]) % M;
  }
  cout << (ans-1+M)%M << '\n';
}
