SPOJ GSS3: Accepted