Clean Python Code with Explaination
\t\t# left: max starting from index 0 (from left)\n        # s: sum(arr)\n        # m: max subarray (start anywhere)\n        # right: max starting from the rig
\t\t# left: max starting from index 0 (from left)\n        # s: sum(arr)\n        # m: max subarray (start anywhere)\n        # right: max starting from the right\n\t\t# result = left + max(0, s) * (k-2) + right\n        # or     = m  \n        #        e.g. [-3,-2, 5, -1] * 2\n\t\t\n```\nclass Solution:\n    def kConcatenationMaxSum(self, arr: List[int], k: int) -> int:\n\n        left = cur = s = m = 0    \n        for num in arr:\n            s += num\n            left = max(left, s)\n            \n            cur += num\n            m = max(m, cur)    \n            cur = 0 if cur < 0 else cur\n                \n        right = cur = 0\n        for num in arr[::-1]:\n            cur += num\n            right = max(right, cur)\n            \n        middle = max(s, 0) * (k - 2)\n        return max(m, (left + middle + right)) % (10**9 + 7)\n\n```
['Python']