#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  map<pair<long long, long long>, pair<long long, long long> > mp;
  for (long long(i) = (0); (i) < (n); ++i) {
    long long a, b;
    cin >> a >> b;
    long long seica = gcd(a, b);
    a /= seica;
    b /= seica;
    int tmp = 0;
    if (a < 0) tmp++;
    if (b < 0) tmp++;
    a = abs(a);
    b = abs(b);
    if (tmp % 2) swap(a, b);
    if (mp.find(make_pair(a, b)) == mp.end())
      mp[make_pair(a, b)] = make_pair(0, 0);
    if (tmp % 2)
      mp[make_pair(a, b)].first++;
    else
      mp[make_pair(a, b)].second++;
  }
  long long ans = 1;
  for (auto node : mp) {
    long long a = 1;
    long long b = 1;
    for (long long(i) = (0); (i) < (node.second.first); ++i)
      a = (a * 2) % 1000000007;
    for (long long(i) = (0); (i) < (node.second.second); ++i)
      b = (b * 2) % 1000000007;
    ans *= (a + b - 1 + 1000000007) % 1000000007;
    ans %= 1000000007;
  }
  cout << (ans - 1 + 1000000007) % 1000000007 << endl;
  return 0;
}
