# -*- coding: utf-8 -*- """ Created on Sat Jun 18 19:56:18 2016 @author: dotha """ def split_str(s): return [sum([int(s[i]) for i in range(0, len(s))]), sum([int(s[i])*(i+1) for i in range(len(s))])] #f = open('pi2.txt', 'r') line = input()#f.readline() tehon = [[4476, 2248951], [4622, 2324217], [4748, 2332239], [4354, 2162664], [4477, 2230808], [4508, 2226440], [4456, 2235064], [4381, 2167923], [4470, 2229018], [4402, 2181490], [4604, 2301796], [4576, 2271585], [4298, 2154999], [4466, 2243000], [4577, 2246124], [4544, 2237578], [4364, 2208024], [4646, 2299834], [4590, 2295427], [4599, 2283923], [4594, 2334532], [4486, 2267695], [4627, 2289956], [4497, 2234248], [4374, 2215004], [4484, 2210004], [4537, 2283626], [4390, 2206185], [4582, 2267010], [4320, 2157530], [4573, 2268580], [4559, 2328251], [4452, 2230827], [4574, 2289504], [4476, 2253760], [4611, 2304068], [4528, 2206831], [4518, 2259643], [4443, 2213559], [4464, 2279547], [4682, 2309075], [4469, 2242341], [4553, 2277576], [4512, 2285719], [4451, 2243168], [4381, 2227275], [4421, 2229152], [4551, 2290016], [4503, 2229285], [4441, 2225467], [4378, 2200625], [4449, 2206481], [4442, 2248027], [4505, 2267289], [4444, 2237795], [4406, 2166636], [4720, 2355012], [4498, 2249260], [4502, 2267492], [4479, 2195294], [4640, 2301077], [4360, 2157059], [4576, 2289080], [4415, 2197117], [4450, 2271984], [4464, 2245073], [4477, 2261448], [4432, 2214537], [4610, 2312328], [4539, 2263388], [4604, 2269477], [4347, 2201931], [4338, 2150796], [4483, 2216039], [4644, 2324742], [4429, 2198193], [4530, 2251995], [4560, 2237927], [4364, 2189167], [4484, 2264582], [4441, 2165159], [4254, 2122025], [4490, 2252774], [4462, 2238844], [4510, 2205181], [4390, 2194807], [4502, 2257133], [4553, 2282216], [4509, 2248505], [4449, 2165403], [4594, 2293687], [4321, 2208072], [4538, 2219621], [4388, 2198228], [4482, 2241984], [4473, 2225263], [4622, 2285371], [4445, 2205968], [4533, 2292859], [4597, 2296947], [4338, 2170896], [4469, 2142313], [4507, 2274059], [4584, 2269442], [4503, 2223779], [4509, 2224883], [4371, 2216035], [4536, 2283669], [4380, 2161027], [4675, 2375895], [4578, 2244625], [4511, 2285582], [4468, 2240935], [4521, 2228099], [4543, 2268899], [4411, 2169775], [4534, 2251732], [4489, 2261842], [4651, 2376283], [4421, 2240489], [4421, 2201681], [4524, 2250040], [4398, 2240534], [4484, 2264759], [4531, 2312971], [4436, 2212632], [4456, 2225256], [4230, 2076721], [4427, 2236266], [4556, 2274386], [4489, 2221961], [4427, 2214904], [4646, 2367235], [4513, 2260452], [4347, 2173026], [4523, 2272464], [4629, 2322608], [4399, 2201058], [4463, 2235101], [4564, 2269085], [4542, 2277781], [4348, 2181607], [4483, 2244723], [4547, 2227120], [4295, 2155371], [4418, 2179368], [4523, 2260294], [4602, 2290094], [4477, 2205493], [4609, 2326806], [4572, 2279308], [4468, 2216510], [4449, 2200333], [4491, 2234716], [4479, 2283595], [4569, 2289186], [4682, 2357698], [4405, 2163605], [4476, 2263885], [4484, 2268883], [4444, 2222363], [4540, 2310099], [4395, 2215351], [4301, 2135619], [4600, 2260219], [4521, 2260110], [4529, 2298958], [4443, 2215594], [4626, 2282526], [4593, 2305665], [4520, 2230346], [4519, 2262524], [4534, 2238069], [4188, 2053249], [4489, 2231378], [4557, 2242918], [4618, 2316405], [4538, 2235522], [4536, 2268242], [4607, 2326721], [4419, 2205678], [4558, 2240527], [4522, 2261135], [4569, 2275433], [4454, 2230458], [4526, 2244087], [4495, 2282817], [4685, 2308106], [4481, 2241328], [4524, 2277854], [4487, 2261649], [4495, 2249698], [4504, 2247317], [4595, 2242540], [4546, 2289367], [4642, 2329622], [4450, 2216877], [4527, 2246075], [4351, 2180473], [4472, 2232654]] n = 1000 if line[0] != "3": print('{} 3'.format(line[0])) for i in range(200000//n): ret = split_str(line[2 + n * i : 2 + n * i + n]) if ret[0] != tehon[i][0]: print('{} {}'.format(ret[0], tehon[i][0])) print('{}'.format((ret[1]-tehon[i][1])//(ret[0]-tehon[i][0]))) b = int(line[1+n*i+(ret[1]-tehon[i][1])//(ret[0]-tehon[i][0])]) a = b - (ret[0]-tehon[i][0]) print ('{} {}'.format(b,a)) #f.close()