C solution
// 3 cases :\n// k=1 : kadane for one\n// sum>0 : kadane for two + (k-2)* sum\n// sum<=0 : kadane for two\n//N=1000000007 preventing data Overflow\n\nint kadane
// 3 cases :\n// k=1 : kadane for one\n// sum>0 : kadane for two + (k-2)* sum\n// sum<=0 : kadane for two\n//N=1000000007 preventing data Overflow\n```\nint kadane(int* arr, int arrSize,int degree){\n    int i,max=arr[0],tmp=0;\n    for(i=0;i<arrSize*degree;i++){\n        tmp += arr[i%arrSize];\n        if(tmp<0){\n            tmp=0;\n        }\n        if(max<tmp){\n            max=tmp;\n        }\n    }\n    return max;\n}\nint kConcatenationMaxSum(int* arr, int arrSize, int k){\n    if(k==1){\n        return kadane(arr,arrSize,1);\n    }\n    long long i,sum=0;\n    long long N=1000000007;\n    for(i=0;i<arrSize;i++){\n        sum+=arr[i];\n    }\n    if(sum>0){\n        return (kadane(arr,arrSize,2)+((k-2)*sum)%N)%N;\n    }else{\n        return (kadane(arr,arrSize,2))%N;\n    }\n}\n```
['C']