import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);
const readBigInt = () => BigInt(readString());

const gcd = (a: bigint, b: bigint) => {
  const _gcd = (a: bigint, b: bigint): bigint => {
    const q = a % b;
    return q === 0n ? b : _gcd(b, q);
  };
  return a > b ? _gcd(a, b) : _gcd(b, a);
};

const abs = (a: bigint) => a > 0n ? a : -a;

(function main() {
  const N = readInt();

  let zero: number = 0;
  const groups: { [k: string]: [number, number] } = {};
  Array.from({ length: N }, () => {
    let A = readBigInt();
    let B = readBigInt();
    if (A === 0n && B === 0n) {
      zero++;
    } else if (A === 0n) {
      groups['0:1'] = groups['0:1'] || [0, 0];
      groups['0:1'][0]++;
    } else if (B === 0n) {
      groups['0:1'] = groups['0:1'] || [0, 0];
      groups['0:1'][1]++;
    } else {
      const n = gcd(abs(A), abs(B));
      A /= n;
      B /= n;
      if (A < 0) {
        A *= -1n;
        B *= -1n;
      }

      if (B > 0) {
        const k = `${A}:${B}`;
        groups[k] = groups[k] || [0, 0];
        groups[k][0]++;
      } else {
        const k = `${-B}:${A}`;
        groups[k] = groups[k] || [0, 0];
        groups[k][1]++;
      }
    }
  });

  const mod = 1000000007;

  let result: number = 1;
  for (const k of Object.keys(groups)) {
    const [xn, yn] = groups[k];

    let tmp: number = 0;
    if (xn) {
      let xx = 1;
      for (let i = 0; i < xn; i++) {
        xx *= 2;
        if (xx > mod) xx %= mod;
      }
      xx -= 1;
      tmp += xx;
    }

    if (yn) {
      let yy = 1;
      for (let i = 0; i < yn; i++) {
        yy *= 2;
        if (yy > mod) yy %= mod;
      }
      yy -= 1;
      tmp += yy;
    }

    tmp++;
    if (tmp > mod) tmp %= mod;

    result *= tmp;
    if (result > mod) result %= mod;
  }

  result += zero - 1;
  if (result > mod) result %= mod;

  console.log(result.toString());
})();
