Untitled Problem II

SPOJ - UNTITLE1