uva; solve "Automatic Answer" from Volume 115