#include <bits/stdc++.h>

int main()
{
	while (true)
	{
		int n, r;
		scanf("%d%d", &n, &r);
		if (n == 0 && r == 0) break;
		std::vector<int> cards(n);
		for (int i{}; i < n; i++) cards[i] = i + 1;

		for (int r_i{}; r_i < r; r_i++)
		{
			int p, c;
			scanf("%d%d", &p, &c);
			for (int c_i{}; c_i < c; c_i++)
				for (int p_i{n - p - c_i}; p_i < n - 1 - c_i; p_i++)
					std::swap(cards[p_i], cards[p_i + 1]);
		}
		printf("%d\n", cards.back());
	}

	return 0;
}
