def bintodec(x):
    """Convert Binary to Decimal. Input is a string and output is a positive integer."""

    num = 0
    n = len(x)
    for i in range(n):
        num = num + 2 ** i * int(x[n - i - 1])
    return num