ABC195 C Comma
コンマの個数は
$ max(0, n - 10^{3i} + 1)(i \geq 1)
となり, これは簡単に計算できる.
実装例:
https://atcoder.jp/contests/abc195/submissions/20879355