#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
vector<long long> Power2;
void initPower2(int expmax) {
  long long power2buf = 1;
  for (int i = 0; i < expmax; i++) {
    Power2.push_back(power2buf);
    power2buf *= 2;
    power2buf %= MOD;
  }
}
long long GCD(long long former, long long latter) {
  if (former % latter == 0) return latter;
  if (latter % former == 0) return former;
  return GCD(latter, former % latter);
}
int main(void) {
  int N;
  long long Abuf, Bbuf;
  vector<pair<long long, long long> > Sociability;
  vector<int> Hatred;
  vector<int> Friendship;
  int Gloomy = 0;
  initPower2(200001);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> Abuf >> Bbuf;
    if ((Abuf != 0LL) || (Bbuf != 0LL)) {
      if (Abuf < 0) {
        Abuf = -Abuf;
        Bbuf = -Bbuf;
      }
      long long gcdAB = GCD(abs(Abuf), abs(Bbuf));
      Sociability.push_back(
          pair<long long, long long>(Abuf / gcdAB, Bbuf / gcdAB));
    } else {
      Gloomy++;
    }
  }
  sort(Sociability.begin(), Sociability.end());
  for (int i = 0; i < Sociability.size(); i++) {
    pair<long long, long long> Hated =
        (Sociability[i].second >= 0
             ? pair<long long, long long>(Sociability[i].second,
                                          -Sociability[i].first)
             : pair<long long, long long>(-Sociability[i].second,
                                          Sociability[i].first));
    int Hbuf = upper_bound(Sociability.begin(), Sociability.end(), Hated) -
               lower_bound(Sociability.begin(), Sociability.end(), Hated);
    Hatred.push_back(Hbuf);
    int Fbuf =
        upper_bound(Sociability.begin(), Sociability.end(), Sociability[i]) -
        lower_bound(Sociability.begin(), Sociability.end(), Sociability[i]);
    Friendship.push_back(Fbuf);
  }
  set<pair<long long, long long> > setSociability;
  long long res = 1;
  for (int i = 0; i < Sociability.size(); i++) {
    if (setSociability.find(Sociability[i]) != setSociability.end()) continue;
    pair<long long, long long> Hated =
        (Sociability[i].second >= 0
             ? pair<long long, long long>(Sociability[i].second,
                                          -Sociability[i].first)
             : pair<long long, long long>(-Sociability[i].second,
                                          Sociability[i].first));
    if (setSociability.find(Hated) != setSociability.end()) continue;
    setSociability.insert(Sociability[i]);
    long long casebuf = Power2[Hatred[i]] + Power2[Friendship[i]] - 1;
    casebuf %= MOD;
    res *= casebuf;
    res %= MOD;
  }
  cout << res + Gloomy - 1 << endl;
  return 0;
}
