```python
def code_sum(code: str) -> int:
    """Sum all figures in the given code."""
    return sum(int(char) for char in code if char.isdigit())

def good_codes(codes: list[str]) -> list[str]:
    """Keep codes whose total divides evenly by three, in order they arrived."""
    return [code for code in sorted(codes, key=lambda x: code_sum(x))]
```