# optimize output length

Q=[]
A=->*x{Q<<[?+,*x]*" "}
C=->*x{Q<<[?<,*x]*" "}

C[2,1,6]
0.upto(28){|i|
 A[6+i,6+i,7+i]
}

29.downto(0){|i|
 A[6+i,4,3]
 C[0,3,36+i]
 if i>0
  C[36+i,6,3]
  i.times{A[3,3,3]}
  A[3,4,4]
 end
}

A[1,6,1]
29.downto(0){|i|
 A[6+i,5,3]
 C[3,1,66+i]
 if i>0
  A[66+i,66+i,3]
  (i-1).times{A[3,3,3]}
  A[3,5,5]
 end
}

58.downto(0){|k|
 [k-29,0].max.upto([k,29].min){|i|
  j=k-i
  C[36+i,66+j,3]
  A[2,3,2]
 }
 A[2,2,2] if k>0
}

puts Q.size,Q