from typing import FrozenSet
from typing import List


def get_profit(solution: FrozenSet[int], profit: List[float]):
    """
    Calculates and returns total profit of given knapsack solution
    :param solution: Knapsack solution consisting of packed items
    :param profit: profit of items
    :return: Total profit of given knapsack solution
    """
    return sum(profit[item - 1] for item in solution)