couldnt solved this one earlier coz i chose int over long long