int main() 
{
    int arr[10] = { 0 };
    long num = 0;
    int i = 0;
    int j = 0;
    int count = 0;
    int m = 0;
    scanf("%d", &num);
    if (num > 100) {
        while (num > 0) {
            arr[i] = num % 10;
            num /= 10;
            i++;
        }
        m = i % 3;
        i = i - 1;
        for (j = 0; j < m; j++) {
            printf("%d", arr[i]);
            i--;
        }
        if (m > 0) {
            printf(",");
        }
        for (; i >= 0; i--) {
            printf("%d", arr[i]);
            count++;
            if (count == 3 && i != 0) {
                printf(",");
                count = 0;
            }
        }
    } else {
        printf("%ld", num);
    }
    return 0;
}