For an algorithm used in Tata Consultancy Services (North America) data-processing workflows, transform an integer array using two sequential rotations. First rotate the array left by left_k positions, then rotate the resulting array right by right_k positions. Return the final array and the sum of its smallest and largest elements.
A rotation wraps elements around the array boundary. Rotation counts may be larger than the array length, so reduce them using modulo arithmetic. The smallest and largest values should be determined from the input values, without sorting the array.
Implement rotate_and_extremes(nums, left_k, right_k), where nums is a non-empty list of integers and left_k and right_k are non-negative integers. Return a two-element list: [rotated_nums, min(nums) + max(nums)].
def rotate_and_extremes(nums, left_k, right_k):