def soma_progressao_aritmetica(n, a1, q):
    return a1 * (q**n - 1) / (q - 1)
    
print(soma_progressao_aritmetica(n=7, a1=1, q=3))