from collections import deque from sys import stdin timer = deque([0] * 9) for i in map(int, stdin.read().strip().split(',')): timer[i] += 1 for i in range(80): timer.rotate(-1) timer[6] += timer[-1] print(sum(timer))