{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eJust now Itachi Uchiha has escaped from Konoha Village using Amaterasu (a visual ninja power). He has collected three numbers \u003ci\u003e\u003cb\u003eB\u003c/i\u003e\u003c/b\u003e, \u003ci\u003e\u003cb\u003eP\u003c/i\u003e\u003c/b\u003e \u0026 \u003ci\u003e\u003cb\u003eM\u003c/i\u003e\u003c/b\u003e before escaping.\n\u003c/p\u003e\n\u003cp\u003e\nAs one of Itachi\u0027s subordinates, you will have to find the value of \u003ci\u003e\u003cb\u003eX\u003c/b\u003e,\u003c/i\u003e where \u003ci\u003e\u003cb\u003eX \u003d (B\u003csup\u003eP\u003c/sup\u003e)\u0026nbsp;mod M\u003c/i\u003e\u003c/b\u003e. Here \u003ci\u003e\u003cb\u003emod\u003c/i\u003e\u003c/b\u003e is the modulo (%) operation which gives the value of the remainder.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\n\tPer line you will be given three numbers \u003ci\u003e\u003cb\u003eB\u003c/i\u003e\u003c/b\u003e, \u003ci\u003e\u003cb\u003eP\u003c/i\u003e\u003c/b\u003e \u0026 \u003ci\u003e\u003cb\u003eM\u003c/i\u003e\u003c/b\u003e \u003cb\u003e(0\u0026lt;\u003dB,P\u0026lt;2\u003csup\u003e31\u003c/sup\u003e\u0026nbsp;and 1\u0026lt;\u003dM\u0026lt;\u003d46340)\u003c/b\u003e. Input will be taken \u003cspan data-scayt_word\u003d\"upto\" data-scaytid\u003d\"1\"\u003eupto\u003c/span\u003e \u003cb\u003eEnd of File\u003c/b\u003e.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\n\tOutput a single line giving the result.\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\u003cspan style\u003d\"font-size:14px;\"\u003e17\n1765\n3\n\n3\n18132\n17\n\n2374859\n3029382\n36123\u003c/span\u003e\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\n\u003cspan style\u003d\"font-size:14px;\"\u003e2\n13\n13195\u003c/span\u003e\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cp\u003e\n\tFor example (2\u003csup\u003e3\u003c/sup\u003e) mod 5 \u003d 3. Because after dividing 5 from 8, we shall get the remainder 3.\u003c/p\u003e"}}]}