In the above calculations, Alice and Bob take the chosen base (g) and raise it to the power of their private key a or b. Alice and Bob then take the result of that operation and calculate its remainder when divided by the prime number (p). The modulo operation (%) ensures the result is above 0 and below p.