void main()
{
    long n = rdElem;
    long z, a, b;
    long[Sardine] cnt;
    Sardine[] list;
    foreach (i; 0 .. n)
    {
        long x, y;
        rdVals(x, y);

        if (!x || !y)
        {
            if (!x && !y) ++z;
            if (!x && y) ++a;
            if (x && !y) ++b;
            continue;
        }

        long g = gcd(x.abs, y.abs);
        long ga = x.abs / g, gb = y.abs / g;
        long s = x.sgn * y.sgn;
        Sardine sardine = Sardine(ga, gb, s);
        if (!(sardine in cnt)) list ~= sardine;
        ++cnt[sardine];
    }

    MInt result = MInt(2L) ^^ a + MInt(2L) ^^ b - 1L;
    foreach (l; list)
    {
        Sardine sardine = Sardine(l.b, l.a, -l.sign);
        MInt x = MInt(cnt[l]), y = MInt(0L);
        if (sardine in cnt) y += cnt[sardine];
        cnt[l] = cnt[sardine] = 0;
        result *= MInt(2L) ^^ x + MInt(2L) ^^ y - 1L;
    }
    result += z - 1L;

    result.writeln;
}

struct Sardine
{
    long a, b, sign;
}

alias MInt = ModInt!(mod);

struct ModInt(long modulus)
{
    long value;

    this(long value)
    {
        this.value = (value + modulus) % modulus;
    }

    ModInt opBinary(string op)(long rhs)
    if (op == "+" || op == "-" || op == "*")
    {
        return typeof(this)(mixin("(this.value "~op~" (rhs % modulus) + modulus) % modulus"));
    }
    ModInt opBinaryRight(string op)(long lhs)
    if (op == "+" || op == "-" || op == "*")
    {
        return opBinary!(op)(lhs);
    }
    ModInt opBinary(string op)(ModInt that)
    if (op == "+" || op == "-" || op == "*")
    {
        return typeof(this)(mixin("(this.value "~op~" that.value + modulus) % modulus"));
    }
    ModInt opBinary(string op)(long divisor)
    if (op == "/")
    {
        return this.value * modPow(divisort, modulus-2);
    }
    ModInt opBinaryRight(string op)(long dividend)
    if (op == "/")
    {
        return ModInt(dividend).value * modPow(this.value, modulus-2);
    }
    ModInt opBinary(string op)(ModInt that)
    if (op == "/")
    {
        return this.value * modPow(that.value, modulus-2);
    }
    ModInt opBinary(string op)(long exponent)
    if (op == "^^")
    {
        return modPow(this.value, exponent);
    }
    ModInt opBinaryRight(string op)(long base)
    if (op == "^^")
    {
        return modPow(base, this.value);
    }
    ModInt opBinary(string op)(ModInt that)
    if (op == "^^")
    {
        return modPow(this.value, that.value);
    }
    ModInt opOpAssign(string op)(long rhs)
    {
        return this = opBinary!(op)(rhs);
    }
    ModInt opOpAssign(string op)(ModInt that)
    {
        return this = opBinary!(op)(that);
    }
    ModInt modPow(long base, long exponent)
    {
        ModInt result = 1;
        while (exponent > 0)
        {
            if (exponent & 1) result = result * base;
            base = base * base % modulus;
            exponent >>= 1;
        }
        return result;
    }

    string toString()
    {
        return this.value.to!string;
    }
}

enum long mod = 10L^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 44684