{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e Given remainders of K modulo some prime numbers. Find smallest positive value of number K satisfying those remainders.\n\nFor example, given prime numbers 2, 3, 5 and also given remainders 1, 2, 3 meaning that K % 2 \u003d 1, K % 3 \u003d 2, K % 5 \u003d 3 respectively. Smallest positive integer value of K satisfying above conditions is K\u003d23.\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\nFirst line contains number N that indicates number of given prime numbers. Each of the next N lines contains two numbers P and R seperated by space. P is a prime number and R is value of remainder for K % P.\n\n($2\\le N\\le 10$, $2\\le P\\le 100$, $0\\le K \u0026lt; P)$\n\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\nOutput smallest K that meet the conditions. All values of K will be less than $10^9$.\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Data Description","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\u003cbr\u003e2 1\u003cbr\u003e3 2\u003cbr\u003e5 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e23\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}