def scale(val: float, factor: int) -> int:
    """
    Multiply val with factor and convert result to an integer with proper
    rounding.

    Arguments:
      val: Float value to rounded
      factor: Value with which val is multiplied.

    Returns:
      Rounded integer value of the product of val and factor.
    """
    num = val * factor
    floor_int = int(num)
    if num - floor_int < 0.5:
        return floor_int
    return floor_int + 1