using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;
namespace AtCoder
{
    class AC
    {
        const int MOD = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;
        const double EPS = 1e-8;
        static readonly int[] dx = { 0, 1, 0, -1 };
        static readonly int[] dy = { 1, 0, -1, 0 };

        
        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            while (true)
            {
                var input = cin.SplitRead();
                int a = input[0];
                int b = input[1];
                if (a == 0 && b == 0) { return; }
                int n = int.Parse(Console.ReadLine());
                var map = new char[a, b];
                var seen = new bool[a, b];
                for (var i = 0; i < a; i++)
                {
                    for (var j = 0; j < b; j++)
                    {
                        map[i, j] = '.';
                        seen[i, j] = false;
                    }
                }
                for (var i = 0; i < n; i++)
                {
                    var wall = cin.SplitRead();
                    map[wall[0] - 1, wall[1] - 1] = '#';
                }

                var dp = new long[a, b];
                for (var i = 0; i < a; i++)
                {
                    for (var j = 0; j < b; j++)
                    {
                        dp[i, j] = i == 0 && j == 0 ? 1 : 0;
                    }
                }

                var bfs = new Queue<Tuple<int, int>>();
                bfs.Enqueue(new Tuple<int, int>(0, 0));

                while (bfs.Count() > 0)
                {
                    var q = bfs.Dequeue();
                    //Console.WriteLine(q);
                    int x = q.Item1;
                    int y = q.Item2;
                    
                    if (x < a - 1)
                    {
                        if (map[x + 1, y] == '.') { dp[x + 1, y] += dp[x, y]; }
                        if (!seen[x + 1, y])
                        {
                            bfs.Enqueue(new Tuple<int, int>(x + 1, y));
                            seen[x + 1, y] = true;
                        }
                    }
                    if (y < b - 1)
                    {
                        if (map[x, y + 1] == '.') { dp[x, y + 1] += dp[x, y]; }
                        if (!seen[x, y + 1])
                        {
                            bfs.Enqueue(new Tuple<int, int>(x, y + 1));
                            seen[x, y + 1] = true;
                        }
                    }
                }

                /*for (var i = 0; i < a; i++)
                {
                    for (var j = 0; j < b; j++)
                    {
                        Console.Write($"{dp[i, j]} ");
                    }
                    Console.WriteLine();
                }*/
                Console.WriteLine(dp[a - 1, b - 1]);
            }

            //Console.Out.Flush();
        }

    }

   

    

    

    public class Scanner
    {
        public int[] SplitRead()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReadL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }
}



Measured memory_bytes: 14764