counter = 0
sums = 0
x = int(input())
while x != 0:
if x % 10 == 7 and x != 0:
counter += 1
sums += x
print(counter)
print(sums)
counter = 0
sums = 0
x = int(input())
while x != 0:
if x % 10 == 7 and x != 0:
counter += 1
sums += x
x = int(input())
print(counter)
print(sums)