N = 395 T = 0 for i in range(1, N+1): if '4' not in str(i): T = T + 1/i print(T)