n←1e6⍴'4'
'cmpx'⎕cy'dfns'
RV←{∊⍺∘,¨@(1~⍨⍸0=3|⊖⍳≢⍵),⍵}
RS←{ ⌽((⌊(1-⍨≢⍵)÷3)+≢⍵)⍴,⍺,⍨ (≢⍵) 3⍴⌽⍵}
JC1←{'(?<=\d)(?=(\d\d\d)+(?!\d))'⎕R ⍺⊢⍵}
JC2←{x←(1,⌽2×0=3|⍳(1-⍨≢⍵))⊂⍵ ⋄ ((0=≢¨x)/x)←⍺ ⋄⊃,/x}
JC3←{⊃,/⍺@(0=≢¨)(1,⌽2×0=3|⍳(1-⍨≢⍵))⊂⍵}
AB1←{⍺@{m}⍵\⍨~m←⌽0 0 0 1⍴⍨¯1+⌈4×3÷⍨≢⍵}
AB2←{⌽'...(?!$)'⎕R'&'⍺⌽⍵}
RG←(3|3-≢⍤⊢)↓∘⌽1↓∘∊,∘(⌽⍴⍨3,⍨∘⌈3÷⍨≢)
s←','
n←1e3⍴'4'