GCJ problem C