var i,j,k,n,ans,p,len,chk,zh:longint; ch:char; s:string; a:array[..] of longint; begin readln(ch); chk:=ord(ch)-; readln(n); to n do begin readln(s); p:=pos(' ',s); val(copy(s,p+,length(s)-p),k); delete(s,p,length(s)-p+); len:=length(s); k:=-*k mod ;…