from typing import Sequence
from typing import Iterable
from typing import Any


def combine(masks: Sequence[int], bits: Iterable[Any]) -> int:
    """Combine bit masks for selected bits using bitwise OR.

    Args:
        masks: Bit masks to selectively combine.

        bits: Bits that select which bit masks to combine.

    Returns:
        Integer value formed by combining the selected bit masks.
    """
    value = 0

    for bit, mask in zip(bits, masks):
        if bit:
            value |= mask

    return value