#include <iostream>
#include <string>

using namespace std;

string commify(unsigned long long n)
{
  string s;
  int cnt = 0;
  do
  {
    s.insert(0, 1, char('0' + n % 10));
    n /= 10;
    if (++cnt == 3 && n)
    {
      s.insert(0, 1, ',');
      cnt = 0;
    }
  } while (n);
  return s;
}

int main()
{
  cout << commify(0) << endl;
  cout << commify(1) << endl;
  cout << commify(999) << endl;
  cout << commify(1000) << endl;
  cout << commify(1000000) << endl;
  cout << commify(1234567890ULL) << endl;
  return 0;
}
