#include <bits/stdc++.h>
using namespace std;
class ModInt {
 public:
  long long n;
  int p;
  ModInt() {}
  ModInt(long long _n, int _p) {
    p = _p;
    n = _n % _p;
    if (n < 0) {
      n += p;
    }
  }
  ModInt operator+(ModInt a) {
    ModInt tmp = ModInt(*this);
    tmp.n += a.n;
    if (tmp.n > tmp.p) {
      tmp.n -= tmp.p;
    }
    return tmp;
  }
  ModInt operator-(ModInt a) {
    ModInt tmp = ModInt(*this);
    tmp.n -= a.n;
    if (tmp.n < 0) {
      tmp.n += tmp.p;
    }
    return tmp;
  }
  ModInt operator*(ModInt a) {
    ModInt tmp = ModInt(*this);
    tmp.n = (tmp.n * a.n) % tmp.p;
    return tmp;
  }
  int modpow(int b, int k) {
    if (k == 0) {
      return 1;
    } else if (k % 2 == 1) {
      long long tmp = b;
      tmp = tmp * modpow(b, k - 1) % p;
      return tmp;
    } else {
      long long tmp = modpow(b, k / 2);
      return tmp * tmp % p;
    }
  }
  int modinv(int b) { return modpow(b, p - 2); }
  ModInt operator/(ModInt a) {
    ModInt tmp = ModInt(*this);
    tmp.n = tmp.n * modinv(a.n) % tmp.p;
    return tmp;
  }
};
ModInt mpow(ModInt mi, int x) {
  if (x == 0) {
    return ModInt(1, 1000000007);
  } else if (x == 1) {
    return mi;
  } else if (x % 2 == 0) {
    ModInt tmp = mpow(mi, x / 2);
    return tmp * tmp;
  } else {
    ModInt tmp = mpow(mi, x / 2);
    return mi * tmp * tmp;
  }
}
class Fraction {
 public:
  long long numerator;
  long long denominator;
  Fraction() {}
  Fraction(long long n, long long d) {
    if (d < 0) {
      d = d * -1;
      n = n * -1;
    }
    long long cd = gcdForFraction(n, d);
    numerator = n / cd;
    denominator = d / cd;
  }
  long long gcdForFraction(long long a, long long b) const {
    long long _a = abs(a);
    long long _b = abs(b);
    if (_a < _b) return gcdForFraction(_b, _a);
    if (_a % _b == 0) {
      return _b;
    } else {
      return gcdForFraction(_a % _b, _b);
    }
  }
  Fraction operator*(Fraction x) {
    Fraction tmp = Fraction(*this);
    tmp.numerator *= x.numerator;
    tmp.denominator *= x.denominator;
    long long d = gcdForFraction(tmp.numerator, tmp.denominator);
    tmp.numerator = tmp.numerator / d;
    tmp.denominator = tmp.denominator / d;
    return tmp;
  }
  Fraction operator/(Fraction x) {
    Fraction tmp = Fraction(*this);
    if (x.numerator < 0) {
      x.numerator = -1 * x.numerator;
      x.denominator = -1 * x.denominator;
    }
    tmp.numerator *= x.denominator;
    tmp.denominator *= x.numerator;
    long long d = gcdForFraction(tmp.numerator, tmp.denominator);
    tmp.numerator = tmp.numerator / d;
    tmp.denominator = tmp.denominator / d;
    return tmp;
  }
  bool operator<(const Fraction x) const {
    long long d = gcdForFraction(denominator, x.denominator);
    long long l = denominator / d * x.denominator;
    long long tmpk = l / denominator;
    long long xk = l / x.denominator;
    return numerator * tmpk < x.numerator * xk;
  }
};
int main() {
  int n;
  cin >> n;
  int zero = 0;
  map<Fraction, int> m;
  int azero = 0;
  int bzero = 0;
  for (int i = 0; i < (n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
    } else if (a == 0) {
      azero++;
    } else if (b == 0) {
      bzero++;
    } else {
      m[Fraction(a, b)]++;
    }
  }
  ModInt ans = ModInt(1, 1000000007);
  map<Fraction, int> check;
  for (auto tmp : m) {
    Fraction tmpf = tmp.first;
    int count1 = tmp.second;
    if (count1 == 0) continue;
    int count2 = m[Fraction(-1, 1) / tmpf];
    ModInt m1 = mpow(ModInt(2, 1000000007), count1) - ModInt(1, 1000000007);
    ModInt m2 = mpow(ModInt(2, 1000000007), count2) - ModInt(1, 1000000007);
    if (check[tmpf] == 0 && check[Fraction(-1, 1) / tmpf] == 0) {
      ans = ans * (m1 + m2 + ModInt(1, 1000000007));
      check[tmpf] = 1;
      check[Fraction(-1, 1) / tmpf] = 1;
    }
  }
  ModInt m1 = mpow(ModInt(2, 1000000007), azero) - ModInt(1, 1000000007);
  ModInt m2 = mpow(ModInt(2, 1000000007), bzero) - ModInt(1, 1000000007);
  ans = ans * (m1 + m2 + ModInt(1, 1000000007));
  ans = ans - ModInt(1, 1000000007);
  ans = ans + ModInt(zero, 1000000007);
  cout << ans.n << endl;
  return 0;
}
