#include <iostream>
#include <sstream>
#include <locale>
#include <climits>
struct my_nump : std::numpunct<char> {
std::string do_grouping() const { return "\3"; }
};
std::string bigNumberWithCommas(unsigned long long n) {
std::ostringstream s;
if(n > 9999)
s.imbue(std::locale(s.getloc(), new my_nump));
s << n;
return s.str();
}
int main()
{
std::cout << bigNumberWithCommas(LLONG_MAX) << '\n'
<< bigNumberWithCommas(1234) << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPGxvY2FsZT4KI2luY2x1ZGUgPGNsaW1pdHM+CgpzdHJ1Y3QgbXlfbnVtcCA6IHN0ZDo6bnVtcHVuY3Q8Y2hhcj4gewogICAgc3RkOjpzdHJpbmcgZG9fZ3JvdXBpbmcoKSBjb25zdCB7IHJldHVybiAiXDMiOyB9Cn07CgpzdGQ6OnN0cmluZyBiaWdOdW1iZXJXaXRoQ29tbWFzKHVuc2lnbmVkIGxvbmcgbG9uZyBuKSB7CiAgICBzdGQ6Om9zdHJpbmdzdHJlYW0gczsKICAgIGlmKG4gPiA5OTk5KQogICAgICAgIHMuaW1idWUoc3RkOjpsb2NhbGUocy5nZXRsb2MoKSwgbmV3IG15X251bXApKTsKICAgIHMgPDwgbjsKICAgIHJldHVybiBzLnN0cigpOwp9CgppbnQgbWFpbigpCnsKICAgIHN0ZDo6Y291dCA8PCBiaWdOdW1iZXJXaXRoQ29tbWFzKExMT05HX01BWCkgPDwgJ1xuJwogICAgICAgICAgICAgIDw8IGJpZ051bWJlcldpdGhDb21tYXMoMTIzNCkgPDwgJ1xuJzsKfQo=