s = "cfimaakj"
n = 554045874191

lenght_s = len(s)

to_repeat = n / lenght_s

quantity_of_a_in_s = s.count("a")

total = 0

if isinstance(to_repeat, float):
    to_repeat = int(to_repeat)
    missing_letters = n - (to_repeat * lenght_s)

    a_in_missing_letters = s[:missing_letters].count("a")

    total = (to_repeat * quantity_of_a_in_s) + a_in_missing_letters
else:
    total = to_repeat * quantity_of_a_in_s
   
print (total)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: