#!/usr/bin/env python3 from lib import primegen def S(p): return (9 * pow(-24, p-2, p)) % p N = 10**8 print(sum(S(p) for p in list(primegen(N))[2:]))