nauuo girl love codingOne day solve problem require calculate sum number modulo pShe write follow code get verdict Wrong answerShe soon discover bug modadd function work number range 0p number problem range she curious wrong function want know result ithowever original code work slow ask help heryou give array a_1a_2ldotsa_n number p Nauuo m query query give l r calculate result Sumalrp you definition Sum function pseudocode aboveNote integer will not overflow code