program c;
{$APPTYPE CONSOLE}                {
var a:array[1..10000] of longint;


procedure QuickSort(iLo, iHi: longint);
var
	Lo, Hi, Mid, T: longint;
begin
	Lo := iLo;
	Hi := iHi;
	Mid := A[(Lo + Hi) div 2];
	repeat
	  while A[Lo] < Mid do Inc(Lo);
	  while A[Hi] > Mid do Dec(Hi);
	  if Lo <= Hi then
	  begin
		T := A[Lo];
		A[Lo] := A[Hi];
		A[Hi] := T;
		Inc(Lo);
		Dec(Hi);
	  end;
	until Lo > Hi;
	if Hi > iLo then QuickSort(A, iLo, Hi);
	if Lo < iHi then QuickSort(A, Lo, iHi);
end;
								 }

var
 a, w, x : array[1..10000] of LongInt;
 t : array[1..9, 0..10000] of LongInt;
 frommax, min, max, cnt, nx, cx, cmd, n, i, j, Cyc1, cyc2, s : LongInt;
 ch : Char;
begin

  Assign(Input, 'chandelier.in');
  Reset(Input);
  Assign(Output, 'chandelier.out');
  Rewrite(Output);

//	ReadLn(n);
	nx := 0;

	n := 0;

	while ((not EOF) and (not EOLn)) do
	begin
		Inc(n);
		i := n;
		Read(ch);
		if (ch = 'a') then
		begin
			a[i] := -1;
			w[i] := 1;
		end
		else
		begin
			a[i] := Ord(ch) - Ord('0');
			cnt := a[i];
			j := i - 1;
			while (cnt > 0) do
			begin
				if (a[j] = -1) then
					Dec(cnt)
				else
					Inc(cnt, a[j] - 1);
				Dec(j);
			end;
			w[i] := i - j - 1;
		end;
	end;





	for i := 1 to n do
	begin
		if (a[i] = -1) then
		begin
			Inc(nx);
			x[nx] := 1;
		end
		else
		begin
			cmd := a[i];
			for Cyc2 := 0 to cmd - 1 do
			begin
				min := 100000;
				max := 0;
				for Cyc1 := nx - cmd + 1 to nx do
					if (x[Cyc1] + (((Cyc1 - nx + cmd) + Cyc2) mod cmd) + 1 > max) then
						max := x[Cyc1] + ((Cyc1 + Cyc2) mod cmd) + 1;
				if (max < min) then
				begin
					min := max;
					frommax := Cyc2;
				end
			end;
			nx := nx - (cmd - 1);
			x[nx] := max;
			cx := i-1;
			s := 0;
			for Cyc1 := 1 to a[i] do
			begin
				for cyc2 := 1 to w[cx] do
					t[Cyc1, Cyc2] := a[cx - w[cx] + Cyc2 - 1];
				t[Cyc1, 0] := w[cx];
				s := s + w[cx];
				cx := cx - w[cx];
			end;
			cx := i - w[i];
			for Cyc1 := 1 to a[i] do
			begin
				for cyc2 := 1 to t[(Cyc1 + frommax) mod a[i] + 1][0] do
					a[cx + Cyc2 - 1] := t[(Cyc1 + frommax) mod a[i] + 1][Cyc2];
				Inc(cx, t[(Cyc1 + frommax) mod a[i] + 1][0]);
			end;

		end;



	end;

	for Cyc1 := 1 to n do
		if (a[Cyc1] = -1) then
			write('a')
		else
			write(a[Cyc1]);

	Close(input);
	Close(output);

end.




aaaaa3aaa2aaa45

