def METHOD_NAME(s: BinaryIO) -> int:
    """
    Unpack a BER integer
    :param s: stream
    """
    if not readUniversalTag(s, Tag.BER_TAG_INTEGER, False):
        raise ValueError("Bad integer tag")
    size = readLength(s)
    if size == 1:
        return Uint8.unpack(s.read(1))
    elif size == 2:
        return Uint16BE.unpack(s.read(2))
    elif size == 3:
        integer1 = Uint8.unpack(s.read(1))
        integer2 = Uint16BE.unpack(s.read(2))
        return (integer1 << 16) + integer2
    elif size == 4:
        return Uint32BE.unpack(s.read(4))
    else:
        raise ValueError("Wrong integer size")