from typing import Dict


def update_model(model: Dict,
                 state: int,
                 action: int,
                 reward: float,
                 next_state: int) -> Dict:
    """
    Stores visited states, actions and their rewards and
    next state in the model dictionary.
    """
    model[(state, action)] = reward, next_state
    return model