def expr(s): global i res=term(s) while i