SPOJ solved problem number 1