def apply_mask(mask, binary):
    """Apply a bitmask to a binary number"""
    applied = []
    for i, j in zip(mask, binary):
        if i == 'X':
            applied.append(j)
        else:
            applied.append(i)
    return ''.join(applied)