import re


def hered_base_to_int(s):
    """
    Take s, a string in hereditary base B notation, and return to corresponding integer
    """
    
    s = re.sub("\^", "**", s)
    s = re.sub("·", "*", s)
    return eval(s)