using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();

        Dictionary<Tuple<long, long>, int[]> map = new Dictionary<Tuple<long, long>, int[]>();
        int zero = 0;

        for (int i = 0; i < n; i++)
        {
            long a = sc.NextLong();
            long b = sc.NextLong();

            if (a == 0 && b == 0)
            {
                zero++;
                continue;
            }

            long gcd = Gcd(a, b);
            a /= gcd;
            b /= gcd;
            if (b < 0 || (b == 0 && a < 0))
            {
                a = -a;
                b = -b;
            }
            bool rotate = a <= 0;
            if (rotate)
            {
                long tmp = a;
                a = b;
                b = -tmp;
            }

            var t = Tuple.Create(a, b);
            if (rotate)
            {
                if (map.ContainsKey(t))
                {
                    map[t][0]++;
                }
                else
                {
                    map.Add(t, new int[] { 1, 0 });
                }
            }
            else
            {
                if (map.ContainsKey(t))
                {
                    map[t][1]++;
                }
                else
                {
                    map.Add(t, new int[] { 0, 1 });
                }
            }
        }

        ModInt answer = new ModInt(1);

        foreach (var item in map)
        {
            ModInt now = new ModInt(1);
            now += ModInt.Pow((new ModInt(2)), (item.Value)[0]) - 1;
            now += ModInt.Pow((new ModInt(2)), (item.Value)[1]) - 1;
            answer *= now;
        }
        answer -= 1; // どれも選ばれなかった場合
        answer += zero; // どれとも仲が悪い物を単体で選ぶ場合

        Console.WriteLine(answer);
    }

    // ModInt
    class ModInt
    {
        public const long Mod = 1000000007;

        public long num;

        public ModInt(long n) { num = n; }

        public override string ToString() { return num.ToString(); }
        public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
        public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
        public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
        public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

        public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

        public static ModInt Pow(long v, long k)
        {
            long ret = 1;
            for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
                if ((k & 1) == 1) ret = ret * v % Mod;
            return new ModInt(ret);
        }

        public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
    }

    // 最大公約数（long）
    private static long Gcd(long a, long b)
    {
        if (a < b)
        {
            return Gcd(b, a);
        }
        while (b != 0)
        {
            long r = a % b;
            a = b;
            b = r;
        }
        return a;
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 66640