SPOJ - One Geometry Problem