SPOJ submission 10055192