/c/?++$c:($s+=$f,$f+=$c)for<>=~/[cw]/g;print$s+0