#!/usr/bin/env python3 import sys import re t = 0 r = re.compile('mul\((\d{1,3}),(\d{1,3})\)') for l in sys.stdin: for m in r.finditer(l): t += int(m.group(1)) * int(m.group(2)) print(t)