SPOJ first problem