program cho_xuat;
uses
System.SysUtils, System.Classes, System.Generics.Collections;
type
Tsum = record
value: Integer;
end;
TsumArray = array of Tsum;
function cho_xuat(N: String; M: Integer): TsumArray;
begin
SetLength(Result, Length(N));
for i := 0 to High(Result) do
begin
if N[i] >= 58 then
Result[i].value := Result[i].value + M
else
Result[i].value := Result[i].value - M;
end;
end;
var
N, M: String;
a: TsumArray;
begin
readln(N, M);
a := cho_xuat(N, M);
WriteLn('KQ: ' + N, ' -> ' + ConvertIntToString(M) + '');
for i := 0 to High(a) do
begin
WriteLn(' + ', a[i].value, ' +', );
end;
end.