Can you answer these queries IV

SPOJ - GSS4