#include <iostream>
using namespace std;
int main()
{
	int n, r, p, q, i, j, k, a[50], b[50], c[50];
	while (cin >> n >> r)
	{
		if (n == 0 && r == 0) break;
		for (i = n; i >= 1; i--)
			a[n-i] = i;
		for (i = 0; i < r; i++)
		{
			cin >> p >> q;
			for (j = 0; j < p-1; j++)
				b[j] = a[j];
			for (j = 0; j < q; j++)
				c[j] = a[p+j-1];
			for (j = 0; j < q; j++)
				a[j] = c[j];
			for (j = 0; j < p-1; j++)
				a[q+j] = b[j];
		}
		cout << a[0] << endl;
	}
}