var framePtr=null,excHandler=0,lastJSError=null;"undefined"==typeof Int8Array&&(Int8Array=Array),"undefined"==typeof Int16Array&&(Int16Array=Array),"undefined"==typeof Int32Array&&(Int32Array=Array),"undefined"==typeof Uint8Array&&(Uint8Array=Array),"undefined"==typeof Uint16Array&&(Uint16Array=Array),"undefined"==typeof Uint32Array&&(Uint32Array=Array),"undefined"==typeof Float32Array&&(Float32Array=Array),"undefined"==typeof Float64Array&&(Float64Array=Array);var NTI3648={size:0,kind:17,base:null,node:null,finalizer:null},NTI3650={size:0,kind:17,base:null,node:null,finalizer:null},NTI37154={size:0,kind:24,base:null,node:null,finalizer:null},NTI3640={size:0,kind:17,base:null,node:null,finalizer:null},NTI3644={size:0,kind:17,base:null,node:null,finalizer:null},NTI3660={size:0,kind:17,base:null,node:null,finalizer:null},NTI104={size:0,kind:31,base:null,node:null,finalizer:null},NTI14009={size:0,kind:18,base:null,node:null,finalizer:null},NTI3608={size:0,kind:17,base:null,node:null,finalizer:null},NTI3711={size:0,kind:22,base:null,node:null,finalizer:null},NTI140={size:0,kind:29,base:null,node:null,finalizer:null},NTI3706={size:0,kind:22,base:null,node:null,finalizer:null},NTI3626={size:0,kind:17,base:null,node:null,finalizer:null},NTI3656={size:0,kind:17,base:null,node:null,finalizer:null},NTI138={size:0,kind:28,base:null,node:null,finalizer:null},NTI37199={size:0,kind:24,base:null,node:null,finalizer:null};NTI37199.base=NTI138;var NNI3656={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI3656.node=NNI3656,NTI3706.base=NTI3626,NTI3711.base=NTI3626;var NNI3626={kind:2,len:5,offset:0,typ:null,name:null,sons:[{kind:1,offset:"parent",len:0,typ:NTI3706,name:"parent",sons:null},{kind:1,offset:"name",len:0,typ:NTI140,name:"name",sons:null},{kind:1,offset:"message",len:0,typ:NTI138,name:"msg",sons:null},{kind:1,offset:"trace",len:0,typ:NTI138,name:"trace",sons:null},{kind:1,offset:"up",len:0,typ:NTI3711,name:"up",sons:null}]};NTI3626.node=NNI3626;var NNI3608={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI3608.node=NNI3608,NTI3626.base=NTI3608,NTI3656.base=NTI3626;var NNI14009={kind:2,len:2,offset:0,typ:null,name:null,sons:[{kind:1,offset:"Field0",len:0,typ:NTI140,name:"Field0",sons:null},{kind:1,offset:"Field1",len:0,typ:NTI104,name:"Field1",sons:null}]};NTI14009.node=NNI14009;var NNI3660={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI3660.node=NNI3660,NTI3660.base=NTI3626;var NNI3644={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI3644.node=NNI3644;var NNI3640={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI3640.node=NNI3640,NTI3640.base=NTI3626,NTI3644.base=NTI3640,NTI37154.base=NTI138;var NNI3650={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI3650.node=NNI3650,NTI3650.base=NTI3626;var NNI3648={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};function setConstr(){for(var n={},e=0;e<arguments.length;++e){var l=arguments[e];if("object"==typeof l)for(var r=l[0];r<=l[1];++r)n[r]=!0;else n[l]=!0}return n}NTI3648.node=NNI3648,NTI3648.base=NTI3626;var ConstSet1=setConstr(17,16,4,18,27,19,23,22,21);function nimCopy(n,e,l){var r=null;switch(l.kind){case 21:case 22:case 23:case 5:r=isFatPointer_20201(l)?[e[0],e[1]]:e;break;case 19:if(null===n||void 0===n)n={};else for(var a in n)delete n[a];for(var a in e)n[a]=e[a];r=n;break;case 18:case 17:nimCopyAux(r=null!=l.base?nimCopy(n,e,l.base):17==l.kind?null===n||void 0===n?{m_type:l}:n:null===n||void 0===n?{}:n,e,l.node);break;case 24:case 4:case 27:case 16:if(null===e)r=null;else{null===n||void 0===n?n=new Array(e.length):n.length=e.length,r=n;for(var t=0;t<e.length;++t)r[t]=nimCopy(r[t],e[t],l.base)}break;case 28:null!==e&&(r=e.slice(0));break;default:r=e}return r}function makeNimstrLit(n){for(var e=n.length,l=new Array(e+1),r=0;r<e;++r)l[r]=n.charCodeAt(r);return l[r]=0,l}function eqStrings(n,e){if(n==e)return!0;if(!n||!e)return!1;var l=n.length;if(l!=e.length)return!1;for(var r=0;r<l;++r)if(n[r]!=e[r])return!1;return!0}function arrayConstr(n,e,l){for(var r=new Array(n),a=0;a<n;++a)r[a]=nimCopy(null,e,l);return r}function cstrToNimstr(n){for(var e=n.length,l=new Array(e),r=0,a=0;a<e;++a){var t=n.charCodeAt(a);t<128?l[r]=t:(t<2048?l[r]=t>>6|192:(t<55296||t>=57344?l[r]=t>>12|224:(++a,t=65536+((1023&t)<<10|1023&n.charCodeAt(a)),l[r]=t>>18|240,l[++r]=t>>12&63|128),l[++r]=t>>6&63|128),l[++r]=63&t|128),++r}return l[r]=0,l}function toJSStr(n){for(var e=n.length-1,l=new Array(e),r=String.fromCharCode,a=null,t=0,i=0;i<e;++i)if(null!==a){var s=2*(i-t),o=n[i].toString(16);1==o.length&&(o="0"+o),a[s]="%",a[s+1]=o}else n[i]<128?l[i]=r(n[i]):(l.length=i,t=i,a=new Array(2*(e-i)),--i);return l=l.join(""),null===a?l:l+decodeURIComponent(a.join(""))}function raiseException(n,e){throw n.name=e,0==excHandler&&unhandledException(n),n.trace=nimCopy(null,rawWriteStackTrace_14228(),NTI138),n}function chckIndx(n,e,l){var r=0;n:do{if(e<=n&&n<=l){r=n;break n}raiseIndexError()}while(0);return r}function chckRange(n,e,l){var r=0;n:do{if(e<=n&&n<=l){r=n;break n}raiseRangeError()}while(0);return r}function addInt(n,e){var l=n+e;return(l>2147483647||l<-2147483648)&&raiseOverflow(),l}var ConstSet2=setConstr(32,9,11,13,10,12),ConstSet3=setConstr([48,57]),ConstSet4=setConstr([48,57]);function subInt(n,e){var l=n-e;return(l>2147483647||l<-2147483648)&&raiseOverflow(),l}function mulInt(n,e){var l=n*e;return(l>2147483647||l<-2147483648)&&raiseOverflow(),l}function rawEcho(){for(var n="",e=0;e<arguments.length;++e)n+=toJSStr(arguments[e]);console.log(n)}var nimvm_6539=!1;process.exitCode=0;var globalRaiseHook_12005=[null],localRaiseHook_12010=[null],outOfMemHook_12013=[null];function isFatPointer_20201(n){var e=!1;n:do{e=!(void 0!=ConstSet1[n.base.kind]);break n}while(0);return e}function nimCopyAux(n,e,l){switch(l.kind){case 0:break;case 1:n[l.offset]=nimCopy(n[l.offset],e[l.offset],l.typ);break;case 2:var r,a=0;r=l.len-1;var t=0;n:for(;t<=r;)a=t,nimCopyAux(n,e,l.sons[a]),t+=1;break;case 3:n[l.offset]=nimCopy(n[l.offset],e[l.offset],l.typ);for(var i=0;i<l.sons.length;++i)nimCopyAux(n,e,l.sons[i][1])}}function nsuSplitChar(n,e,l){var r=null;r=nimCopy(null,[],NTI37199);var a=0,t=l;n:do{e:for(;a<=(null!=n?n.length-1:0);){var i=a;l:for(;a<(null!=n?n.length-1:0)&&n[a]!=e;)a+=1;0==t&&(a=null!=n?n.length-1:0);var s=nimCopy(null,n.slice(i,a-1+1).concat(0),NTI138);if(null!=r?r.push(s):r=[s],0==t)break n;t-=1,a+=1}}while(0);return r}function add_12029(n,e,l){for(var r=n[0].length-1,a=0;a<l.length;++a)n[0][r]=l.charCodeAt(a),++r;n[0][r]=0}function auxWriteStackTrace_14004(n){var e=[null],l=n,r=0,a=0,t=arrayConstr(64,{Field0:null,Field1:0},NTI14009);n:for(;null!=l&&r<=63;)t[r].Field0=l.procname,t[r].Field1=l.line,r+=1,a+=1,l=l.prev;n:for(;null!=l;)a+=1,l=l.prev;e[0]=nimCopy(null,makeNimstrLit(""),NTI138),a!=r&&(null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit("(")):e[0]=makeNimstrLit("("),null!=e[0]?e[0]=e[0].slice(0,-1).concat(cstrToNimstr(a-r+"")):e[0]=cstrToNimstr(a-r+""),null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit(" calls omitted) ...\n")):e[0]=makeNimstrLit(" calls omitted) ...\n"));var i=0,s=r-1;n:for(;0<=s;)add_12029(e,0,t[i=s].Field0),0<t[i].Field1&&(null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit(", line: ")):e[0]=makeNimstrLit(", line: "),null!=e[0]?e[0]=e[0].slice(0,-1).concat(cstrToNimstr(t[i].Field1+"")):e[0]=cstrToNimstr(t[i].Field1+"")),null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit("\n")):e[0]=makeNimstrLit("\n"),s-=1;return e[0]}function rawWriteStackTrace_14228(){return nimCopy(null,null!=framePtr?makeNimstrLit("Traceback (most recent call last)\n").slice(0,-1).concat(auxWriteStackTrace_14004(framePtr)):makeNimstrLit("No stack traceback available\n"),NTI138)}function unhandledException(n){var e=[makeNimstrLit("")];!eqStrings(n.message,null)&&!(0==n.message[0])?(null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit("Error: unhandled exception: ")):e[0]=makeNimstrLit("Error: unhandled exception: "),null!=e[0]?e[0]=e[0].slice(0,-1).concat(n.message):e[0]=n.message):null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit("Error: unhandled exception")):e[0]=makeNimstrLit("Error: unhandled exception"),null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit(" [")):e[0]=makeNimstrLit(" ["),add_12029(e,0,n.name),null!=e[0]?e[0]=e[0].slice(0,-1).concat(makeNimstrLit("]\n")):e[0]=makeNimstrLit("]\n"),null!=e[0]?e[0]=e[0].slice(0,-1).concat(rawWriteStackTrace_14228()):e[0]=rawWriteStackTrace_14228();var l=toJSStr(e[0]);throw framePtr=null,"undefined"!=typeof Error?new Error(l):l}function raiseIndexError(){var n=null;(n={m_type:NTI3656,parent:null,name:null,message:null,trace:null,up:null}).message=nimCopy(null,makeNimstrLit("index out of bounds"),NTI138),n.parent=null,raiseException(n,"IndexError")}function raiseRangeError(){var n=null;(n={m_type:NTI3660,parent:null,name:null,message:null,trace:null,up:null}).message=nimCopy(null,makeNimstrLit("value out of range"),NTI138),n.parent=null,raiseException(n,"RangeError")}function raiseOverflow(){var n=null;(n={m_type:NTI3644,parent:null,name:null,message:null,trace:null,up:null}).message=nimCopy(null,makeNimstrLit("over- or underflow"),NTI138),n.parent=null,raiseException(n,"OverflowError")}function map_53210(n,e){var l=null,r={procname:"map.map",prev:framePtr,filename:"lib/pure/collections/sequtils.nim",line:0};framePtr=r,r.line=217,l=new Array(chckRange(null!=n?n.length:0,0,2147483647));for(var a=0;a<chckRange(null!=n?n.length:0,0,2147483647);++a)l[a]=0;r.line=218;var t=0;r.line=3518;var i;r.line=218,i=null!=n?n.length:0,r.line=3519;var s=0;r.line=3520;n:for(;s<i;)r.line=3521,t=s,r.line=219,l[chckIndx(t,0,l.length+0-1)-0]=e(n[chckIndx(t,0,n.length+0-1)-0]),r.line=3522,s=addInt(s,1);return framePtr=r.prev,l}function nsuSplitCharSet(n,e,l){var r=null;r=nimCopy(null,[],NTI37154);var a=0,t=l;n:do{e:for(;a<=(null!=n?n.length-1:0);){var i=a;l:for(;a<(null!=n?n.length-1:0)&&void 0==e[n[a]];)a+=1;0==t&&(a=null!=n?n.length-1:0);var s=nimCopy(null,n.slice(i,a-1+1).concat(0),NTI138);if(null!=r?r.push(s):r=[s],0==t)break n;t-=1,a+=1}}while(0);return r}function rawParseInt_27995(n,e,l,r){var a=0,t={procname:"parseutils.rawParseInt",prev:framePtr,filename:"lib/pure/parseutils.nim",line:0};framePtr=t,t.line=232;var i=-1;t.line=233;var s=r;if(43==n[chckIndx(s,0,n.length+0-1)-0]?(t.line=234,s=addInt(s,1)):45==n[chckIndx(s,0,n.length+0-1)-0]&&(t.line=236,s=addInt(s,1),t.line=237,i=1),void 0!=ConstSet3[n[chckIndx(s,0,n.length+0-1)-0]]){t.line=239,e[l]=0,t.line=240;n:for(;void 0!=ConstSet4[n[chckIndx(s,0,n.length+0-1)-0]];){t.line=241,e[l]=subInt(mulInt(e[l],10),subInt(n[chckIndx(s,0,n.length+0-1)-0],48)),t.line=242,s=addInt(s,1),t.line=243;e:for(;95==n[chckIndx(s,0,n.length+0-1)-0];)t.line=243,s=addInt(s,1)}t.line=244,e[l]=mulInt(e[l],i),t.line=245,a=subInt(s,r)}return framePtr=t.prev,a}function npuParseBiggestInt(n,e,l,r){var a,t={procname:"parseutils.parseBiggestInt",prev:framePtr,filename:"lib/pure/parseutils.nim",line:0};framePtr=t,t.line=253;var i=[0];return t.line=256,a=rawParseInt_27995(n,i,0,r),t.line=257,e[l]=i[0],framePtr=t.prev,a}function npuParseInt(n,e,l,r){var a,t={procname:"parseutils.parseInt",prev:framePtr,filename:"lib/pure/parseutils.nim",line:0};framePtr=t,t.line=264;var i=[0];if(t.line=265,a=npuParseBiggestInt(n,i,0,r),i[0]<-2147483648||2147483647<i[0]){t.line=268,t.line=2810;var s=null;t.line=2811,s={m_type:NTI3644,parent:null,name:null,message:null,trace:null,up:null},t.line=2812,s.message=nimCopy(null,makeNimstrLit("overflow"),NTI138),t.line=2813,s.parent=null,raiseException(s,"OverflowError")}else 0!=a&&(t.line=270,e[l]=chckRange(i[0],-2147483648,2147483647));return framePtr=t.prev,a}function nsuParseInt(n){var e=[0],l=npuParseInt(n,e,0,0);if(l!=(null!=n?n.length-1:0)||0==l){var r=null;(r={m_type:NTI3650,parent:null,name:null,message:null,trace:null,up:null}).message=nimCopy(null,makeNimstrLit("invalid integer: ").slice(0,-1).concat(n),NTI138),r.parent=null,raiseException(r,"ValueError")}return e[0]}function sysFatal_23221(n){var e={procname:"sysFatal.sysFatal",prev:framePtr,filename:"lib/system.nim",line:0};framePtr=e,e.line=2830;var l=null;e.line=2831,l={m_type:NTI3648,parent:null,name:null,message:null,trace:null,up:null},e.line=2832,l.message=nimCopy(null,n,NTI138),e.line=2833,raiseException(l,"AssertionError"),framePtr=e.prev}function raiseAssert_23216(n){var e={procname:"system.raiseAssert",prev:framePtr,filename:"lib/system.nim",line:0};framePtr=e,e.line=3771,sysFatal_23221(n),framePtr=e.prev}function failedAssertImpl_23239(n){var e={procname:"system.failedAssertImpl",prev:framePtr,filename:"lib/system.nim",line:0};framePtr=e,e.line=3778,raiseAssert_23216(n),framePtr=e.prev}function main_53001(n){var e={procname:"aoj.main",prev:framePtr,filename:"aoj.nim",line:0};framePtr=e,e.line=6;var l=nsuSplitChar(n,10,-1);e.line=7;var r=null;e.line=3805;var a=0;e.line=3806;var t=null!=l?l.length:0;e.line=3807;n:for(;a<t;){e.line=3808,r=l[chckIndx(a,0,l.length+0-1)-0],e.line=9;var i=map_53210(nsuSplitCharSet(r,ConstSet2,-1),nsuParseInt);e.line=10;var s=i[chckIndx(0,0,i.length+0-1)-0];e.line=11;var o=i[chckIndx(1,0,i.length+0-1)-0];e.line=12,rawEcho(cstrToNimstr(addInt(s,o)+"")),e.line=3809,a=addInt(a,1),(null!=l?l.length:0)!=t&&(e.line=3810,failedAssertImpl_23239(makeNimstrLit("len(a) == L seq modified while iterating over it")))}framePtr=e.prev}!function(){"use strict";var n=[];require("readline").createInterface({input:process.stdin,output:process.stdout}).on("line",function(e){n.push(e)}),process.stdin.on("end",function(){main_53001(makeNimstrLit(n.join("\n")))})}();


Measured memory_bytes: 17844