Python Solution
\nclass Solution(object):\n    def maxSubarray(self, A):\n        if not A:\n            return 0\n        curSum = maxSum = A[0]\n        for i in range(1,len(
```\nclass Solution(object):\n    def maxSubarray(self, A):\n        if not A:\n            return 0\n        curSum = maxSum = A[0]\n        for i in range(1,len(A)):\n            curSum = max(A[i], curSum + A[i])\n            maxSum = max(curSum, maxSum)\n        \n        return max(maxSum,0)\n        \n    def kConcatenationMaxSum(self, arr, k):\n        """\n        :type arr: List[int]\n        :type k: int\n        :rtype: int\n        """\n        arrSum = sum(arr)\n        MOD = (10**9 + 7)\n        if k == 1:\n            return self.maxSubarray(arr)%MOD\n        if k == 2:\n            return self.maxSubarray(2*arr)%MOD\n        if k > 2 and arrSum > 0:\n            return (self.maxSubarray(arr+arr) + (k-2)*arrSum)%MOD\n        else:\n            return self.maxSubarray(2*arr)%MOD\n        \n        \n```
['Python']