Vika decide trip Bertown she come Bertown kth day Vika want spend money hotel fortunately n friend live Bertown allow Vika stay house the ith friend tell Vika stay house l_ith day till r_ith day inclusivevika decide stay friend house help Vika determine maximum number day able stay Bertown