import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Sample142 {
	public final Point goal_;
	private final Set<Point> blocedList_ = new HashSet<Point>();

	public Sample142(int x, int y) {
		goal_ = new Point(x, y);
	}
	public void addBlocked(int x, int y) {
		blocedList_.add(new Point(x, y));
	}

	public int calc() {
		return calc(goal_.x, goal_.y);
	}
	private int calc(int x, int y) {
		Set<Point> prev = previousPoint(x, y);
		if (prev.isEmpty()) return 1;
		int count = 0;
		for (Point p: prev) {
			if (blocedList_.contains(p)) continue;
			count += calc(p.x, p.y);
		}
		return count;
	}
	private Set<Point> previousPoint(int x, int y) {
		Set<Point> result = new HashSet<Point>();
		if (x > 1) result.add(new Point(x - 1, y));
		if (y > 1) result.add(new Point(x, y - 1));
		return result;
	}


	public static class Point {
		public final int x;
		public final int y;

		public Point(int x, int y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj) return true;
			if (!(obj instanceof Point)) return false;
			Point other = (Point) obj;
			return this.x == other.x && this.y == other.y;
		}
		@Override
		public int hashCode() {
			return x * 17 + y;
		}
	}

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try {
			String[] goal = reader.readLine().split("\\s");
			Sample142 sample = new Sample142(Integer.parseInt(goal[0]), Integer.parseInt(goal[1]));
			int n = Integer.parseInt(reader.readLine());
			for (int index = 0; index < n; index++) {
				String[] closed = reader.readLine().split("\\s");
				sample.addBlocked(Integer.parseInt(closed[0]), Integer.parseInt(closed[1]));
			}
			int result = sample.calc();
			System.out.println(result);
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}
}
