#include <bits/stdc++.h>
using namespace std;
long long n, ans = 1, cnt = 0, cnt_a, cnt_b;
double a, b, key, to_search;
map<double, long long> mip;
set<double> s;
vector<pair<long long, long long> > v;
long long power(long long a, long long p) {
  if (p == 0) {
    return 1;
  }
  if (p == 1) {
    return a % 1000000007;
  }
  if (p % 2 == 0) {
    long long x = power(a, p / 2) % 1000000007;
    return (x * x) % 1000000007;
  } else {
    long long x = power(a, p - 1) % 1000000007;
    return (a * x) % 1000000007;
  }
}
void solve() {
  cin >> n;
  cnt_b = 0, cnt_a = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    if (a && b)
      mip[a / b]++;
    else if (a == 0)
      cnt_a++;
    else
      cnt_b++;
  }
  v.push_back({cnt_a, cnt_b});
  for (auto itr : mip) {
    key = itr.first;
    to_search = (1.0 / key) * -1.0;
    if (s.find(key) != s.end()) continue;
    if (mip.find(to_search) != mip.end()) {
      v.push_back({itr.second, mip[to_search]});
      s.insert(key);
      s.insert(to_search);
    } else {
      v.push_back({itr.second, 0});
      s.insert(key);
    }
  }
  for (auto p : v) {
    cnt = 0;
    cnt += power(2, p.first);
    cnt %= 1000000007;
    cnt += power(2, p.second);
    cnt %= 1000000007;
    cnt -= 1;
    cnt = (cnt + 1000000007) % 1000000007;
    ans *= cnt;
    ans %= 1000000007;
  }
  cout << ans - 1 << endl;
}
signed main() {
  solve();
  return 0;
}
