three numbers spoj solution