def parse(inFile):
    return inFile.readline()

def solve(text):
    N = len(text)
    x = [1 if c == "w" else 0 for c in text]
    for c in "elcome to code jam":
        x = [0] + [(sum(x[:i]) % 10000) if text[i] == c else 0 for i in xrange(1, N)]
    return "%04d" % (sum(x) % 10000)

if __name__ == "__main__":
    from GCJ import GCJ
    GCJ(parse, solve, "/Users/lpebody/gcj/2009_q/", "c").run()
