#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long p(long long n) {
  if (n == 0) {
    return 1;
  }
  if (n == 1) {
    return 2;
  }
  long long tmp = p(n / 2);
  long long tmp2 = tmp * tmp;
  tmp2 %= MOD;
  if (n % 2 == 0) {
    return tmp2;
  } else {
    return (tmp2 * 2) % MOD;
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, int> m;
  int cnt_a0_b0 = 0;
  int cnt_a0 = 0;
  int cnt_b0 = 0;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++cnt_a0_b0;
      continue;
    }
    if (a == 0) {
      ++cnt_a0;
      continue;
    }
    if (b == 0) {
      ++cnt_b0;
      continue;
    }
    long long g = gcd(abs(a), abs(b));
    long long c = abs(a) / g;
    long long d = abs(b) / g;
    if (a < 0 && b > 0) {
      ++m[make_pair(-c, d)];
    } else if (a > 0 && b < 0) {
      ++m[make_pair(-c, d)];
    } else {
      ++m[make_pair(c, d)];
    }
  }
  long long ans = cnt_a0_b0;
  vector<pair<int, int>> s;
  for (auto e : m) {
    auto p = e.first;
    int c = e.second;
    long long a = p.first;
    long long b = p.second;
    if (a < 0) {
      if (m.find(make_pair(b, -a)) != m.end()) {
        s.push_back(make_pair(c, m[make_pair(b, -a)]));
      } else {
        s.push_back(make_pair(c, -1));
      }
    } else {
      if (m.find(make_pair(-b, a)) != m.end()) {
      } else {
        s.push_back(make_pair(c, -1));
      }
    }
  }
  if (cnt_a0 + cnt_b0 > 0) {
    if (cnt_a0 == 0 || cnt_b0 == 0) {
      s.push_back(make_pair(cnt_a0 + cnt_b0, -1));
    } else {
      s.push_back(make_pair(cnt_a0, cnt_b0));
    }
  }
  long long tmp = 1;
  for (auto e : s) {
    long long a = e.first;
    long long b = e.second;
    long long tmp2 = p(a);
    if (b > -1) {
      tmp2 += p(b) - 1;
      tmp2 %= MOD;
    }
    tmp *= tmp2;
    tmp %= MOD;
  }
  if (ans > 0) {
    ans += tmp;
  } else {
    ans += tmp - 1;
    if (ans < 0) {
      ans += MOD;
    }
  }
  cout << ans % MOD << endl;
}
