count=0
s=0
fname = input("Enter file name: ")
fh = open(fname)
for line in fh:
    if not line.startswith("X-DSPAM-Confidence:") :
        continue
    else:
        count=count+1
        a=line.find('0')
        x=line[a:]
        s=s+float(x)
avg=s/count
print("Average spam confidence:",avg)