#include<bits/stdc++.h>
using namespace std;
int main(){
  int t;
  cin>>t;
  while(t--){
    int a,b;
    cin>>a>>b;
    if(a==b) cout<<0<<endl;
    else if(a>b){
      if(abs(a-b)%2==1) cout<<2<<endl;
      else cout<<1<<endl;
    }
    else{
      if(abs(a-b%2==1)) cout<<1<<endl;
      else cout<<2<<endl;
    }
  }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
  int t;
  cin>>t;
  while(t--){
    long long int a,b;
    cin>>a>>b;
    if(a==b) cout<<0<<endl;
    else if(a>b){
      if(abs(a-b)%2==1) cout<<2<<endl;
      else cout<<1<<endl;
    }
    else{
      if(abs(a-b)%2==1) cout<<1<<endl;
      else cout<<2<<endl;
    }
  }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
  int t;
  cin>>t;
  while(t--){
    long long int a,b;
    cin>>a>>b;
    if(a==b) cout<<0<<endl;
    else if(a>b){
      if(abs(a-b)%2==1) cout<<2<<endl;
      else cout<<1<<endl;
    }
    else{
      if(abs(a-b%2==1)) cout<<1<<endl;
      else cout<<2<<endl;
    }
  }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int readin()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll qmod(ll a,ll b,ll mod)
{
	ll r=1;
	while(b)
	{
		if(b&1)
		r=r*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return r;
}
ll exgcd(ll a,ll b,ll &x,ll &y)
{
	if(a==0&&b==0)
	return -1;
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll d=exgcd(b,a%b,y,x);
	y-=a/b*x;
	return d;
}
ll niyuan(ll a,ll n)
{
	ll x,y;
	ll d=exgcd(a,n,x,y);
	if(d==1)
	return (x%n+n)%n;
	return -1;
}
int main()
{
    int i,j;
    int t=readin();
    while(t--)
    {
        int a=readin(),b=readin();
        if(a==b)
        {
            cout<<0<<endl;
            continue;
        }
        if(a<b)
        {
            if(a%2==1 && b%2==0)
            {
                cout<<1<<endl;
                continue;
            }
            else
            if(a%2==1 && b%2==1)
            {
                cout<<b-a<<endl;
                continue;
            }
            else
            if(a%2==0 && b%2==0)
            {
                cout<<b-a<<endl;
                continue;
            }
            else
            if(a%2==0 && b%2==1)
            {
                cout<<b-a<<endl;
                continue;
            }
        }
        if(a>b)
        {
            if(a%2==0 && b%2==0)
            {
                cout<<1<<endl;
                continue;
            }
            if(a%2==0 && b%2==1)
            {
                cout<<2<<endl;
                continue;
            }
            if(a%2==1 && b%2==0)
            {
                cout<<2<<endl;
                continue;
            }
            if(a%2==1 && b%2==1)
            {
                cout<<1<<endl;
                continue;
            }
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int readin()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll qmod(ll a,ll b,ll mod)
{
	ll r=1;
	while(b)
	{
		if(b&1)
		r=r*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return r;
}
ll exgcd(ll a,ll b,ll &x,ll &y)
{
	if(a==0&&b==0)
	return -1;
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll d=exgcd(b,a%b,y,x);
	y-=a/b*x;
	return d;
}
ll niyuan(ll a,ll n)
{
	ll x,y;
	ll d=exgcd(a,n,x,y);
	if(d==1)
	return (x%n+n)%n;
	return -1;
}
int main()
{
    int i,j;
    int t=readin();
    while(t--)
    {
        int a=readin(),b=readin();
        if(a==b)
        {
            cout<<0<<endl;
            continue;
        }
        if(a<b)
        {
            if(a%2==1 && b%2==0)
            {
                cout<<1<<endl;
                continue;
            }
            else
            {
                cout<<b-a<<endl;
                continue;
            }
        }
        if(a>b)
        {
            if(a%2==b%2)
            {
                cout<<1<<endl;
                continue;
            }
            else
            {
                cout<<2<<endl;
                continue;
            }
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int readin()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll qmod(ll a,ll b,ll mod)
{
	ll r=1;
	while(b)
	{
		if(b&1)
		r=r*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return r;
}
ll exgcd(ll a,ll b,ll &x,ll &y)
{
	if(a==0&&b==0)
	return -1;
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll d=exgcd(b,a%b,y,x);
	y-=a/b*x;
	return d;
}
ll niyuan(ll a,ll n)
{
	ll x,y;
	ll d=exgcd(a,n,x,y);
	if(d==1)
	return (x%n+n)%n;
	return -1;
}
int main()
{
    int i,j;
    int t=readin();
    while(t--)
    {
        int a=readin(),b=readin();
        if(a==b)
        {
            cout<<0<<endl;
            continue;
        }
        if(a<b)
        {
            if(a%2==1 && b%2==0)
            {
                cout<<1<<endl;
                continue;
            }
            else
            {
                cout<<2<<endl;
                continue;
            }
        }
        if(a>b)
        {
            if(a%2==b%2)
            {
                cout<<1<<endl;
                continue;
            }
            else
            {
                cout<<2<<endl;
                continue;
            }
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int readin()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll qmod(ll a,ll b,ll mod)
{
	ll r=1;
	while(b)
	{
		if(b&1)
		r=r*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return r;
}
ll exgcd(ll a,ll b,ll &x,ll &y)
{
	if(a==0&&b==0)
	return -1;
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll d=exgcd(b,a%b,y,x);
	y-=a/b*x;
	return d;
}
ll niyuan(ll a,ll n)
{
	ll x,y;
	ll d=exgcd(a,n,x,y);
	if(d==1)
	return (x%n+n)%n;
	return -1;
}
int main()
{
    int i,j;
    int t=readin();
    while(t--)
    {
        int a=readin(),b=readin();
        int gc=b-a;
        if(a==b)
        {
            cout<<0<<endl;
            continue;
        }
        if(gc>0)
        {
            if(gc%2==1)
            {
                cout<<1<<endl;
            }
            else
            {
                cout<<2<<endl;
            }
        }
        if(gc<0)
        {
            if(gc%2==1)
            {
                cout<<2<<endl;
            }
            else
            {
                cout<<1<<endl;
            }
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int readin()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll qmod(ll a,ll b,ll mod)
{
	ll r=1;
	while(b)
	{
		if(b&1)
		r=r*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return r;
}
ll exgcd(ll a,ll b,ll &x,ll &y)
{
	if(a==0&&b==0)
	return -1;
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll d=exgcd(b,a%b,y,x);
	y-=a/b*x;
	return d;
}
ll niyuan(ll a,ll n)
{
	ll x,y;
	ll d=exgcd(a,n,x,y);
	if(d==1)
	return (x%n+n)%n;
	return -1;
}
int main()
{
    int i,j;
    int t=readin();
    while(t--)
    {
        int a=readin(),b=readin();
        int gc=b-a;
        if(a==b)
        {
            cout<<0<<endl;
            continue;
        }
        if(gc>0)
        {
            if(gc%2==1)
            {
                cout<<1<<endl;
            }
            else
            {
                cout<<2<<endl;
            }
        }
        if(gc<0)
        {
            gc=-gc;
            if(gc%2==1)
            {
                cout<<2<<endl;
            }
            else
            {
                cout<<1<<endl;
            }
        }
    }
}


#include<iostream>
#include<vector>
using namespace std;
int  main()
{
	int n,c,d;
	vector<int> a,b;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>c;
	cin>>d;
	a.push_back(c);
	b.push_back(d);
}
	for(int i=0;i<n;i++){
if (a[i]<b[i]&&(a[i]-b[i])%2==0)
cout<<2;
else if (a[i]<b[i]&&(a[i]-b[i])%2!=0)
cout<<1;
else if (a[i]>b[i]&&(a[i]-b[i])%2!=0)
cout<<1;
else if (a[i]>b[i]&&(a[i]-b[i])%2==0)
cout<<2;
else
cout<<0;
cout<<endl;}
return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int  main()
{
	long long int n,c,d;
	vector<long long int> a,b;
	cin>>n;
	for(long long int i=0;i<n;i++){
	cin>>c;
	cin>>d;
	a.push_back(c);
	b.push_back(d);
}
	for(long long int i=0;i<n;i++){
if (a[i]<b[i]&&(a[i]-b[i])%2==0)
cout<<2;
else if (a[i]<b[i]&&(a[i]-b[i])%2!=0)
cout<<1;
else if (a[i]>b[i]&&(a[i]-b[i])%2!=0)
cout<<2;
else if (a[i]>b[i]&&(a[i]-b[i])%2==0)
cout<<1;
else
cout<<0;
cout<<endl;}
return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int  main()
{
	long long int n,c,d;
	vector<long long int> a,b;
	cin>>n;
	for(long long int i=0;i<n;i++){
	cin>>c;
	cin>>d;
	a.push_back(c);
	b.push_back(d);
}
	for(long long int i=0;i<n;i++){
if (a[i]<b[i]&&(a[i]-b[i])%2==0)
cout<<2;
else if (a[i]<b[i]&&(a[i]-b[i])%2!=0)
cout<<1;
else if (a[i]>b[i]&&(a[i]-b[i])%2!=0)
cout<<1;
else if (a[i]>b[i]&&(a[i]-b[i])%2==0)
cout<<2;
else
cout<<0;
cout<<endl;}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            cout<<0<<'\n';

        }
        if(a>b){
            if((a-b)%2==0)
            cout<<1<<'\n';
            else
            cout<<2<<'\n';
        }else{
             if((b-a)%2==0)
            cout<<2<<'\n';
            else
            cout<<1<<'\n';
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            cout<<0<<'\n';
            break;
        }
        if(a>b){
            if((a-b)%2==0)
            cout<<1<<'\n';
            else
            cout<<2<<'\n';
        }else{
             if((b-a)%2==0)
            cout<<2<<'\n';
            else
            cout<<1>>'\n';
        }
    }

    return 0;
}


#include <bits/stdc++.h>

int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            cout<<0<<'\n';
            break;
        }
        if(a>b){
            if((a-b)%2==0)
            cout<<1<<'\n';
            else
            cout<<2<<'\n';
        }else{
             if((b-a)%2==0)
            cout<<2<<'\n';
            else
            cout<<1>>'\n';
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            cout<<0<<'\n';

        }
        if(a>b){
            if((a-b)%2==0)
            cout<<2<<'\n';
            else
            cout<<1<<'\n';
        }else{
             if((b-a)%2==0)
            cout<<1<<'\n';
            else
            cout<<2<<'\n';
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            cout<<0<<'\n';
            break;
        }
        if(a>b){
            if((a-b)%2==0)
            cout<<1<<'\n';
            else
            cout<<2<<'\n';
        }else{
             if((b-a)%2==0)
            cout<<2<<'\n';
            else
            cout<<1<<'\n';
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            cout<<0<<'\n';

        }else
        if(a>b){
            if((a-b)%2==0)
            cout<<1<<'\n';
            else
            cout<<2<<'\n';
        }else{
             if((b-a)%2==0)
            cout<<2<<'\n';
            else
            cout<<1<<'\n';
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            cout<<0<<'\n';
            break;
        }
        if(a>b){
            if((a-b)%2==0)
            cout<<2<<'\n';
            else
            cout<<1<<'\n';
        }else{
             if((b-a)%2==0)
            cout<<1<<'\n';
            else
            cout<<2<<'\n';
        }
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int t,a,b;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if(a==b)
            cout<<"0"<<endl;
        else if(a>b&&(a-b)%2==0)
        {
            cout<<"1"<<endl;
        }
        else if(a<b&&(b-a)%2)
        {
           cout<<"1"<<endl;
        }
        else
            cout<<"2"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int t,a,b;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if(a==b)
            cout<<"0"<<endl;
        else{
        if(b%2==0)
        {
           cout<<"2"<<endl;
        }
        else
            cout<<"1"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int t,a,b,num;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if(a==b)
            cout<<"0"<<endl;
        else if(a>b)
        {
                num=a-b;
        if(num && 1)
        {
           cout<<"2"<<endl;
        }
        else
            cout<<"1"<<endl;
        }
        else
        {
                num=b-a;
        if(num && 1)
        {
           cout<<"1"<<endl;
        }
        else
            cout<<"2"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,x,y,i,t,j,c=0;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>a>>b;
        if(a==b)
        cout<<0<<endl;
        else if(a<b && (b-a)%2==0)
        {
            if(a==2&&b==4)
            cout<<2<<endl;
            else
            cout<<3<<endl;
        }
        else if(a<b && (b-a)%2!=0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2==0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2!=0)
        {
            cout<<2<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,x,y,i,t,j,c=0;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>a>>b;
        if(a==b)
        cout<<0<<endl;
        else if(a<b && (b-a)%2==0)
        {

            cout<<2<<endl;
        }
        else if(a<b && (b-a)%2!=0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2==0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2!=0)
        {
            cout<<2<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,x,y,i,t,j,c=0;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>a>>b;
        if(a==b)
        cout<<0;
        else if(a<b && (b-a)%2==0)
        {
            cout<<3<<endl;
        }
        else if(a<b && (b-a)%2!=0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2==0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2!=0)
        {
            cout<<2<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,x,y,i,t,j,c=0;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>a>>b;
        if(a==b)
        cout<<0;
        else if(a<b && (b-a)%2==0)
        {
            cout<<2<<endl;
        }
        else if(a<b && (b-a)%2!=0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2==0)
        {
            cout<<1<<endl;
        }
        else if(a>b && (a-b)%2!=0)
        {
            cout<<2<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define Debug(x) cerr << #x << ": " << x << endl;

inline int read() {
	char c = getchar(); int x = 0, f = 1;
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	return x * f;
}

int main() {
	int T = read();
	while (T--) {
		int x = read(), y = read(), ans;
		if (x == y) ans = 0;
		else if ((x < y && (y - x) % 2 == 1) || (x > y && (x - y) % 2 == 0)) ans = 1;
		else ans = 2;
		printf("%d\n", ans);
	}
	return 0;
}


#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
	    int a, b;
	    cin >> a >> b;
	    if(a > b)
	    {
	        if(a % b == 0)
	        {
	            cout << "1\n";
	        }
	        else
	        {
	            cout << "2\n";
	        }
	    }
	    else if(b > a)
	    {
	        if(b % a % 2 != 0)
	        {
	            cout << "1\n";
	        }
	        else
	        {
	            cout << "2\n";
	        }
	    }
	    else
	    {
	        cout << "0\n";
	    }
	}
	return 0;
}


#include<cstdio>
int t;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
int ans(int a,int b)
{
    if(a==b)return 0;
    if(a>b)
    {
        if((a&1)==(b&1))return 1;
        return 2;
    }
    if((a&1)!=(b&1))return 1;
    return 2;
}
int main()
{
    t=read();
    while(t--)printf("%d\n",ans(read(),read()));
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
long long a,b;
int main() {
    int T;
    scanf("%d",&T);
    while(T--)
    {
    	scanf("%lld%lld",&a,&b);
	    if(a<b)
	    {
	      if(b%2==0)
	       {
	         if(a%2==0)  printf("2\n");
	          else printf("1\n");
	       }
	      else {
	         if(a%2==0)  printf("1\n");
	          else printf("2\n");
	      }
	    }
	    else if(a==b)printf("0\n");
	    else {
	    if(b%2==0)
	      {
	        if(a%2==0)  printf("1\n");
	         else printf("2\n");
	      }
	     else {
	        if(a%2==0)  printf("2\n");
	         else printf("1\n");
	    }
	 }
    }
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int T;
	scanf("%d" , &T);
	while(T -- > 0) {
		int a , b;
		scanf("%d %d" , &a , &b);
		if(a == b) printf("0\n");
		else if(a > b) {
			if((a - b) & 1) printf("2\n");
			else printf("1\n");
		}
		else {
			if((b - a) & 1) printf("1\n");
			else printf("2\n");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int n,a,b;

int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);

	cin>>n;
	while(n--) {
		cin>>a>>b;
		if(a==b) {
			cout<<0<<endl;
		}
		else if(a>b) {
			if((a-b)%2==0) {
				cout<<1<<endl;
			}
			else {
				cout<<2<<endl;
			}
		}
		else if(a<b) {
			if((b-a)%2==1) {
				cout<<1<<endl;
			}
			else {
				cout<<2<<endl;
			}
		}
	}

	//fclose(stdin);
	//fclose(stdout);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int a,b,t;
int main()
{
	cin>>t;
	for(int i=1;i<=t;i++){
		cin>>a>>b;
		if(a==b){
			cout<<0<<endl;
		}
		else if(a<b)
		{
			if(a%2==b%2)
			{
				cout<<2<<endl;
			}
			else cout<<1<<endl;
		}
		else if(a>b)
		{
			if(a%2==b%2)
			{
				cout<<1<<endl;
			}
			else cout<<2<<endl;
		}
	}

	return 0;
}


#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
	    int a, b;
	    cin >> a >> b;
	    if(a > b)
	    {
	        if((a - b) % 2 == 0)
	        {
	            cout << "1\n";
	        }
	        else
	        {
	            cout << "2\n";
	        }
	    }
	    else if(b > a)
	    {
	        if((b - a) % 2 != 0)
	        {
	            cout << "1\n";
	        }
	        else
	        {
	            cout << "2\n";
	        }
	    }
	    else
	    {
	        cout << "0\n";
	    }
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int f[20001],a[31];
int main()
{
  long long t,a,b;
  cin>>t;
  while(t--)
  {
    cin>>a>>b;
    if(a==b)
    {
      cout<<0<<endl;
    }
    else if((a%2)==(b%2) && a>b)
    {
      cout<<1<<endl;
    }
    else  if((a%2)==(b%2) && b>a)
    {
      cout<<2<<endl;
    }
    else if((a%2)!=(b%2) && a<b)
    {
      cout<<1<<endl;
    }
    else  if((a%2)!=(b%2) && b<a)
    {
      cout<<2<<endl;
    }
  }
  return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==b)
        cout<<0<<endl;
        else if(a<b && a%b==0)
        cout<<2<<endl;
        else if(a<b && a%2==1)
        cout<<1<<endl;
        else if(a>b && a%b==0)
        cout<<1<<endl;
        else
        cout<<2<<endl;

    }
}


#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==b)
        cout<<0<<endl;
        else if((b-a)>0)
        {
            if((b-a)%2==0)
            cout<<1<<endl;
            else
            cout<<2<<endl;
        }
        else
        {
            if((abs(b-a))%2==0)
            cout<<2<<endl;
            else
            cout<<1<<endl;
        }

    }
}


#incluse<bits/stdc++.h>
using namepace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==b)
        cout<<0<<endl;
        else if((b-a)>0)
        {
            if((b-a)%2==0)
            cout<<2<<endl;
            else
            cout<<1<<endl;
        }
        else
        {
            if((abs(b-a))%2==0)
            cout<<1<<endl;
            else
            cout<<2<<endl;
        }

    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int t;
    cin >> t;
    for(int i = 0; i < t; i++) {
        int n,k,z;
        cin >> n >> k >> z;
        vector<int>a(n);
        for(int i = 0; i < n; i++) {
            cin >> a[i];
        }
        priority_queue<P,vector<P>,less<P>> que;
        int sum = a[0];
        for(int j = 1; j <= k; j++) {
            sum+=a[j];
            que.push({a[j-1]+a[j],j});
        }
        int r = k,l = -1;
        int cnt2 = 0;
        while(!que.empty() && r >= 1 && cnt2 < z) {
            P x = que.top();
            if(x.second+1 > r) {
                que.pop();
            }
            else {
                if(a[r]+a[r-1] > x.first) {
                    goto home;
                }
                sum-=a[r]+a[r-1];
                sum+=x.first;
                r-=2;
                l = x.second-1;
                cnt2++;
            }
        }
    home:;
        if(cnt2 < z && r >= 1) {
            int res = a[r];
            for(int j = r-1; j >= 0; j--) {
                if(j == l) {
                    continue;
                }
                if(a[j] > res) {
                    res = a[j];
                }
            }
            sum-=a[r];
            sum+=res;
        }
        cout << sum << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int t;
    cin >> t;
    for(int i = 0; i < t; i++) {
        int n,k,z;
        cin >> n >> k >> z;
        vector<int>a(n);
        for(int i = 0; i < n; i++) {
            cin >> a[i];
        }
        priority_queue<P,vector<P>,less<P>> que;
        int sum = a[0];
        for(int j = 1; j <= k; j++) {
            sum+=a[j];
            que.push({a[j-1]+a[j],j});
        }
        int r = k,l = -1;
        int cnt2 = 0;
        while(!que.empty() && r >= 1 && cnt2 < z) {
            P x = que.top();
            if(x.second+1 > r) {
                que.pop();
            }
            else {
                if(a[r]+a[r-1] > x.first) {
                    goto home;
                }
                sum-=a[r]+a[r-1];
                sum+=x.first;
                r-=2;
                l = x.second-1;
                cnt2++;
            }
        }
    home:;
        if(cnt2 < z-1 && r >= 1) {
            int res = a[r];
            for(int j = r-1; j >= 0; j--) {
                if(j == l) {
                    continue;
                }
                if(a[j] > res) {
                    res = a[j];
                }
            }
            sum-=a[r];
            sum+=res;
        }
        cout << sum << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int t;
    cin >> t;
    for(int i = 0; i < t; i++) {
        int n,k,z;
        cin >> n >> k >> z;
        vector<int>a(n);
        for(int i = 0; i < n; i++) {
            cin >> a[i];
        }
        priority_queue<P,vector<P>,less<P>> que;
        int sum = a[0];
        for(int j = 1; j <= k; j++) {
            sum+=a[j];
            que.push({a[j-1]+a[j],j});
        }
        int r = k,l = -1;
        int cnt2 = 0;
        while(!que.empty() && r >= 1 && cnt2 < z) {
            P x = que.top();
            if(x.second+1 > r) {
                que.pop();
            }
            else {
                if(a[r]+a[r-1] > x.first) {
                    break;
                }
                sum-=a[r]+a[r-1];
                sum+=x.first;
                r-=2;
                l = x.second-1;
                cnt2++;
            }
        }
        cout << sum << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int t;
    cin >> t;
    for(int i = 0; i < t; i++) {
        int n,k,z;
        cin >> n >> k >> z;
        vector<int>a(n);
        int sum = 0;
        for(int j = 0; j < n; j++) {
            cin >> a[j];
            if(j <= k) {
                sum+=a[j];
            }
        }
        int ans = sum;
        int res = a[0];
        for(int j = 1; j <= k; j++) {
            res+=a[j];
            int X = a[j]+a[j-1];
            if((k-j)/2 <= z) {
                ans = max(ans,res+X*((k-j)/2)+(k-j)%2*((j+1 < n)?0:a[j+1]));
                if((k-j)%2+(k-j)/2 <= z) {
                    ans = max(ans,res+X*((k-j)/2)+(k-j)%2*((j+1 < n)?max(a[j+1],a[j-1]):a[j-1]));
                }
            }
            else {
                int cnt2 = res+X*z;
                for(int l = j+X*z+1; l <= k; l++) {
                    cnt2+=a[l];
                }
                ans = max(ans,cnt2);
            }
        }
        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		ll rr=0;
		while(z--)
		{
			if(la<1)
			{
				break;
			}
			while(k<2)
			{
				k++;
				out-=a[la];
				la--;
			}
			k-=2;
			if(la<1)
			{
				break;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			rr++;
			ma=max(ma,out+(maa*rr));
		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll pre[n];
		for(ll i=0;i<n;i++)
		{
			pre[i]=a[i];
			if(i)
			{
				pre[i]+=pre[i-1];
			}
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		while(z--)
		{
			if(la<1)
			{
				break;
			}
			while(k<2)
			{
				k++;
				out-=a[la];
				la--;
			}
			k-=2;
			if(la<1)
			{
				break;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			ma=max(ma,out+maa);
		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		ll rr=0;
		while(z-- && la>2)
		{
			k=2;
			while(k--)
			{
				out-=a[la];
				la--;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			rr++;
			ma=max(ma,out+(maa*rr));
		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		ll rr=0;
		while(z-- )
		{
			if(z+1 && la>1)
			{
				ll maa=0;
				for(ll i=0;i<la-1;i++)
				{
					maa=max(maa,a[i]+a[i+1]);
				}
				ma=max(ma,out-a[la]+(maa*rr)+a[la-2]);
			}
			k=2;
			while(k--)
			{
				out-=a[la];
				la--;
			}
			if(la==0)
			{
				break;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			rr++;
			ma=max(ma,out+(maa*rr));

		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll pre[n];
		for(ll i=0;i<n;i++)
		{
			pre[i]=a[i];
			if(i)
			{
				pre[i]+=pre[i-1];
			}
		}
		ll ma=0;
		ll out=0;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				ll x=k;
				ll u=a[i]+a[i-1];
				ll sum=out;

				sum+=min(z,x/2)*u;;

				x-=(2*min(z,x/2));

				if(x)
				{
					sum+=pre[min(i+x,n-1)];
					sum-=pre[i];
				}
				ma=max(ma,sum);
			}
			if(k==0)
			{
				break;
			}

		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		while(z--)
		{
			if(la<1)
			{
				break;
			}
			while(k<2)
			{
				k++;
				out-=a[la];
				la--;
			}
			k-=2;
			if(la<1)
			{
				break;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			ma=max(ma,out+maa);
			out+=maa;
		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		ll rr=0;
		while(z-- )
		{
			if( la>1)
			{
				ll maa=0;
				for(ll i=0;i<la-1;i++)
				{
					maa=max(maa,a[i]+a[i+1]);
				}
				ma=max(ma,out-a[la]+(maa*rr)+a[la-2]);
			}
			k=2;
			while(k--)
			{
				out-=a[la];
				la--;
			}
			if(la==0)
			{
				break;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			rr++;
			ma=max(ma,out+(maa*rr));

		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll pre[n];
		for(ll i=0;i<n;i++)
		{
			pre[i]=a[i];
			if(i)
			{
				pre[i]+=pre[i-1];
			}
		}
		ll ma=0;
		ll out=0;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				ll x=k;
				ll u=a[i]+a[i-1];
				ll sum=out;

				sum+=min(z,x/2)*u;;

				x-=(2*min(z,x/2));

				if(x)
				{
					sum+=pre[min(i+x,n-1)];
					sum-=pre[i];
				}
				ma=max(ma,sum);
			}

		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		ll rr=0;
		while(z-- )
		{
			if( la>1)
			{
				ll maa=0;
				for(ll i=0;i<la-1;i++)
				{
					maa=max(maa,a[i]+a[i+1]);
				}
				ma=max(ma,out-a[la]+(maa*rr)+a[la-2]);
			}
			k=2;
			while(k--)
			{
				out-=a[la];
				la--;
			}
			if(la<=0)
			{
				break;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			rr++;
			ma=max(ma,out+(maa*rr));

		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll pre[n];
		for(ll i=0;i<n;i++)
		{
			pre[i]=a[i];
			if(i)
			{
				pre[i]+=pre[i-1];
			}
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		while(z--)
		{
			while(k<2)
			{
				k++;
				out-=a[la];
				la--;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			ma=max(ma,out+maa);
		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll pre[n];
		for(ll i=0;i<n;i++)
		{
			pre[i]=a[i];
			if(i)
			{
				pre[i]+=pre[i-1];
			}
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		while(z--)
		{
			if(la<1)
			{
				break;
			}
			while(k<2)
			{
				k++;
				out-=a[la];
				la--;
			}
			if(la<1)
			{
				break;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			ma=max(ma,out+maa);
		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n,k,z;
		cin>>n>>k>>z;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		ll out=0;
		ll la=n-1;
		for(ll i=0;i<n;i++)
		{
			out+=a[i];
			if(i)
			{
				k--;
				if(k==0)
				{
					la=i;
					break;
				}
			}
		}
		ll ma=out;
		ll rr=0;
		while(z-- && la>2)
		{
			if(z+1)
			{
				ll maa=0;
				for(ll i=0;i<la-1;i++)
				{
					maa=max(maa,a[i]+a[i+1]);
				}
				ma=max(ma,out-a[la]+(maa*rr)+a[la-2]);
			}
			k=2;
			while(k--)
			{
				out-=a[la];
				la--;
			}
			ll maa=0;
			for(ll i=0;i<la;i++)
			{
				maa=max(maa,a[i]+a[i+1]);
			}
			rr++;
			ma=max(ma,out+(maa*rr));

		}
		cout<<ma<<"\n";
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

int dp[N][6][2];
long long a[N];
int n, k, z;

long long solve(int i, int left, int prv, int moves)
{
	if(moves == k)
	{
		return a[i];
	}
	if(dp[i][left][prv] != -1)
	{
		return dp[i][left][prv];
	}
	long long sol = a[i] + solve(i + 1, left, 0, moves + 1);
	if(prv == 0 and left + 1 <= z)
	{
		sol = max(sol, a[i] + solve(i - 1, left + 1, 1, moves + 1));
	}
	return dp[i][left][prv] = sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		cin >> n >> k >> z;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		memset(dp, -1, sizeof dp);
		cout << solve(0, 0, 1, 0) << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

int n, k, z;
vector<int> a(N);

long long solve(int i, bool left, int k, int z)
{
	if(k == 0)
	{
		return 0;
	}
	long long sol = 0;
	sol = a[i] + solve(i + 1, false, k - 1, z);
	if(z > 0 and left == false and i > 0)
	{
		sol = max(sol, a[i] + solve(i - 1, true, k - 1, z - 1));
	}
	return sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
//		int n, k, z;
		cin >> n >> k >> z;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		cout << solve(0, false, k + 1, z) << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

long long dp[N][6][2];
long long a[N];
int n, k, z;

long long solve(int i, int left, int prv, int moves)
{
	if(moves == k)
	{
		return a[i];
	}
	if(dp[i][left][prv] != -1)
	{
		return dp[i][left][prv];
	}
	long long sol = a[i] + solve(i + 1, left, 0, moves + 1);
	if(prv == 0 and left + 1 <= z)
	{
		sol = max(sol, a[i] + solve(i - 1, left + 1, 1, moves + 1));
	}
	return dp[i][left][prv] = sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		cin >> n >> k >> z;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		memset(dp, -1, sizeof dp);
		cout << solve(0, 0, 1, 0) << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

long long dp[N][6][2];
int a[N];
int n, k, z;

long long solve(int i, int left, int prv, int moves)
{
	if(moves == k)
	{
		return a[i];
	}
	if(dp[i][left][prv] != -1)
	{
		return dp[i][left][prv];
	}
	long long sol = a[i] + solve(i + 1, left, 0, moves + 1);
	if(prv == 0 and left + 1 <= z)
	{
		sol = max(sol, a[i] + solve(i - 1, left + 1, 1, moves + 1));
	}
	return dp[i][left][prv] = sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		cin >> n >> k >> z;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		memset(dp, -1, sizeof dp);
		cout << solve(0, 0, 1, 0) << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

long long dp[N][2][6];
int a[N];

long long solve(int i, int k, int left, int z)
{
	if(k == 0)
	{
		return 0;
	}
	if(dp[i][left][z] != -1)
	{
		return dp[i][left][z];
	}
	long long sol = a[i] + solve(i + 1, k - 1, 0, z);
	if(i > 0 and left == 0 and z > 0)
	{
		sol = max(sol, a[i] + solve(i - 1, k - 1, 1, z - 1));
	}
	return dp[i][left][z] = sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		int n, k, z;
		cin >> n >> k >> z;
//		int a[n];
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		memset(dp, -1, sizeof dp);
		cout << solve(0, k + 1, 0, z) << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		int n, k, z;
		cin >> n >> k >> z;
		long long a[n];
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		vector<long long> pref(n + 1), mx(n + 1);
		for(int i = 0; i < n; i++)
		{
			pref[i + 1] = pref[i] + a[i];
			if(i > 0)
			{
				mx[i] = max(mx[i], (long long)a[i] + a[i - 1]);
			}
		}
		long long sol = pref[k + 1];
		for(int i = k; i > 0; i--)
		{
			if((k + 2 - i) / 2 > z)
			{
				break;
			}
			long long val = pref[i];
			if((k - i + 1) % 2 != 0 and i - 2 >= 0)
			{
				val += a[i - 2];
			}
			val += mx[i - 1] * ((k - i + 1) / 2);
			sol = max(sol, val);
		}
		cout << sol << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		int n, k, z;
		cin >> n >> k >> z;
		vector<long long> a;
		long long sum = 0;
		vector<long long> v(n + 1);
		for(int i = 0; i < n; i++)
		{
			int x;
			cin >> x;
			if(i <= k)
			{
				a.push_back(x);
				sum += x;
				if(i > 0)
				{
					v[i] = max(v[i], a[i] + a[i - 1]);
				}
			}
		}
		long long sol = sum;
		int i = 0;
		int j = k;
		while((int) a.size() > 0)
		{
			if((i + 1) / 2 > z)
			{
				break;
			}
			long long val = sum;
			int temp = a.back();
			a.pop_back();
			if(i & 1 and (int) a.size() > 0)
			{
				val += a.back();
			}
			val += v[k] * (i / 2);
			sol = max(sol, val);
			sum  -= temp;
			i++;
			k--;
		}
		cout << sol << "\n";

	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		int n, k, z;
		cin >> n >> k >> z;
		long long a[n];
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		vector<long long> pref(n + 1), mx(n + 1);
		for(int i = 0; i < n; i++)
		{
			pref[i + 1] = pref[i] + a[i];
			if(i > 0)
			{
				mx[i] = max(mx[i], (long long)a[i] + a[i - 1]);
			}
		}
		long long sol = pref[k + 1];
		for(int i = k; i > 0; i--)
		{
			if((k + 2 - i) / 2 > z)
			{
				continue;
			}
			long long val = pref[i];
			if((k - i + 1) % 2 != 0)
			{
				val += a[i - 2] * (k - i + 2) / 2;
			}
			else
			{
				val += mx[i - 1] * (k - i + 1) / 2;
			}
			sol = max(sol, val);
		}
		cout << sol << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

long long dp[N][6][2];
long long a[N];
int n, k, z;

long long solve(int i, int left, int prv, int moves)
{
	if(moves == k)
	{
		return a[i];
	}
	if(dp[i][left][prv] != -1)
	{
		return dp[i][left][prv];
	}
	long long sol = a[i] + solve(i + 1, left, 0, moves + 1);
	if(prv == 0 and left + 1 <= z)
	{
		sol = max(sol, a[i] + solve(i - 1, left + 1, 1, moves + 1));
	}
	return dp[i][left][prv] = sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		cin >> n >> k >> z;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i <= n; i++)
		{
			for(int j = 0; j <= 5; j++)
			{
				for(int k = 0; k <= 1; k++)
				{
					dp[i][j][k] = -1;
				}
			}
		}
		cout << solve(0, 0, 1, 0) << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

int n, k, z;
vector<int> a(N);

long long solve(int i, bool left, int k, int z)
{
	if(k == 0)
	{
		return 0;
	}
	long long sol = 0;
	sol = a[i] + solve(i + 1, false, k - 1, z);
	if(z > 0 and left == false and i > 0 and (i + 1 < n and a[i + 1] < a[i]))
	{
		sol = max(sol, a[i] + solve(i - 1, true, k - 1, z - 1));
	}
	return sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
//		int n, k, z;
		cin >> n >> k >> z;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		cout << solve(0, false, k + 1, z) << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

const int N = 1e5 + 10;

long long dp[N][6][2];
long long a[N];
int n, k, z;

long long solve(int i, int left, int prv, int moves)
{
	if(moves == k)
	{
		return a[i];
	}
	if(dp[i][left][prv] != -1)
	{
		return dp[i][left][prv];
	}
	long long sol = a[i] + solve(i + 1, left, 0, moves + 1);
	if(prv == 0 and left + 1 <= z)
	{
		sol = max(sol, a[i] + solve(i - 1, left + 1, 1, moves + 1));
	}
	return dp[i][left][prv] = sol;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	int T;
	cin >> T;
	while(T--)
	{
		cin >> n >> k >> z;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		int K = 6;
		int prv = 2;
		memset(dp, -1, dp[n + 1][K][prv]);
		cout << solve(0, 0, 1, 0) << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves == k) return numbers[at];

	int &ans = dp[at][left_already][last_right];
	if (ans != -1) return ans;

	ans = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		for (int i = 1; i <= n; i++) {
			for (int j = 0; j < 6; j++) {
				for (int k = 0; k < 2; k++) {
					dp[i][j][k] = -1;
				}
			}
		}
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl "\n"

const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][6][2];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves == k) return numbers[at];
	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	int ans = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		for (int i = 1; i <= n; i++) {
			for (int j = 0; j < 6; j++) {
				for (int k = 0; k < 2; k++) {
					dp[i][j][k] = -1;
				}
			}
		}
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl "\n"

const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][6][2];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves == k) return numbers[at];
	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	value = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) value = max(value, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return value;
}

signed main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		for (int i = 1; i <= n; i++) {
			for (int j = 0; j < 6; j++) {
				for (int k = 0; k < 2; k++) {
					dp[i][j][k] = -1;
				}
			}
		}
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][6][2];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves == k) return numbers[at];
	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	int ans = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		for (int i = 1; i <= n; i++) {
			for (int j = 0; j < 6; j++) {
				for (int k = 0; k < 2; k++) {
					dp[i][j][k] = -1;
				}
			}
		}
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][6][2];

int solve(int at, int left_already, bool last_right) {
	int moves_already = at - 1 + left_already * 2;
	if (moves_already == k) return numbers[at];

	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	int ans = numbers[at] + solve(at + 1, left_already, true);
	if (at > 1 and last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];

int solve(int at, int left_already, bool last_right) {
	int moves_already = at - 1 + left_already * 2;
	if (moves_already > k) return 0;

	int &ans = dp[at][left_already][last_right];
	if (ans != -1) return ans;

	ans = numbers[at] + solve(at + 1, left_already, true);
	if (at > 1 and last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves_already == k) return numbers[index];

	int &ans = dp[at][left_already][last_right];
	if (ans != -1) return ans;

	ans = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves == k) return numbers[at];

	int &ans = dp[at][left_already][last_right];
	if (ans != -1) return ans;

	ans = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][6][2];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves == k) return numbers[at];
	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	int ans = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl "\n"

const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][6][2];

int solve(int at, int left_already, bool last_right, int moves) {
	if (moves == k) return numbers[at];
	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	int ans = numbers[at] + solve(at + 1, left_already, true, moves + 1);
	if (last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false, moves + 1));
	return ans;
}

signed main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		for (int i = 1; i <= n; i++) {
			for (int j = 0; j < 6; j++) {
				for (int k = 0; k < 2; k++) {
					dp[i][j][k] = -1;
				}
			}
		}
		int ans = solve(1, 0, false, 0);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];

int solve(int at, int left_already, bool last_right) {
	int moves_already = at - 1 + left_already * 2;
	if (moves_already > k) return 0;

	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	int ans = numbers[at] + solve(at + 1, left_already, true);
	if (at > 1 and last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false));
	return ans;

	/*if (last_right) {
		if (at > 1) {
			value = numbers[at] + max(solve(at + 1, left_already, true), solve(at - 1, left_already + 1, false));
			return value;
		}
		else {
			value = numbers[at] + solve(at + 1, left_already, true);
			return value;
		}
	}

	else {
		value = numbers[at] + solve(at + 1, left_already, true);
		return value;
	}*/
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];

int solve(int at, int left_already, bool last_right) {
	int moves_already = at - 1 + left_already * 2;
	if (moves_already > k or left_already > z) return 0;

	int &value = dp[at][left_already][last_right];
	if (value != -1) return value;

	if (last_right) {
		if (at > 1) {
			value = numbers[at] + max(solve(at + 1, left_already, true), solve(at - 1, left_already + 1, false));
			return value;
		}
		else {
			value = numbers[at] + solve(at + 1, left_already, true);
			return value;
		}
	}

	else {
		value = numbers[at] + solve(at + 1, left_already, true);
		return value;
	}
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false);
		cout << ans << endl;
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];

int solve(int at, int left_already, bool last_right) {
	int moves_already = at - 1 + left_already * 2;
	if (moves_already > k) return 0;

	int &ans = dp[at][left_already][last_right];
	if (ans != -1) return ans;

	int ans = numbers[at] + solve(at + 1, left_already, true);
	if (at > 1 and last_right and left_already < z) ans = max(ans, numbers[at] + solve(at - 1, left_already + 1, false));
	return ans;
}

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;

	while (t--) {
		cin >> n >> k >> z;
		for (int i = 1; i <= n; i++) cin >> numbers[i];
		memset(dp, -1, sizeof(dp));
		int ans = solve(1, 0, false);
		cout << ans << endl;
	}
	return 0;

}


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{
     lli n,k,z,msum=INT_MIN,idx=0;

     cin>>n>>k>>z;

     lli ans=0;
     lli arr[n+100]={0};
     for(lli i=1;i<=n;i++)
     {
          cin>>arr[i];
     }

     for(lli i=1;i<=(k+1);i++)
     {
          ans=ans+arr[i];

          if(i<=k)
          {
               if((arr[i]+arr[i+1])>=msum)
               {
                    msum=arr[i]+arr[i+1];
                    idx=i;
               }
          }
     }
     if(z==0)
     {
          cout<<ans;
          return ;
     }
     if(((2*z)-1)<=(k-idx))
     {
           ans=0;
          for(lli i=1;i<=idx+1;i++)
          {
                ans=ans+arr[i];
          }

          k=k-idx;

          while(z)
          {
               if(k)
               {
                    ans=ans+arr[idx];
                    k--;
               }
               z--;
               if(k&&z)
               {
                    k--;
                    ans=ans+arr[idx+1];
               }
          }

          idx++;
          while(k)
          {
               k--;
               ans=ans+arr[idx];
               idx++;
          }

          cout<<ans;

     }
     else
     {
          ans=0;

          for(lli i=1;i<=idx+1;i++)
          {
               ans=ans+arr[i];
          }

          if((k-idx)%2)
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
               ans=ans+arr[idx];
          }
          else
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
          }

          cout<<ans;
          return ;
     }

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][7][2];//this is classic  dp question where (s,k,(0,1)) s is index and k tells me about the number of
//  I have taken  and the third part is to  tell me wheather last step was left or not
lli a[S];
lli cache(lli idx,lli left,lli last,lli moves)
{
    if(moves==k)
    {
        return a[idx];
    }

    if(dp[idx][left][last]!=-1)
    return dp[idx][left][last];

    dp[idx][left][last]=INT_MIN;

     dp[idx][left][last]=a[idx]+cache( idx+1, left, 0, moves+1);

     if(last==0&&left+1<=z)
     {
        dp[idx][left][last]=max(dp[idx][left][last],a[idx]+cache( idx-1, left+1, last^1, moves+1));
     }

     return dp[idx][left][last];

}

void solve()
{
    cin>>n>>k>>z;

    for(lli i=1;i<=n;i++)
    {
        for(lli j=0;j<=k;j++)
        {
            for(lli l=0;l<=1;l++)
            {
                dp[i][j][l]=-1;
            }
        }
    }

    for(lli i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    lli ans=cache(1,0,1,0);

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{
     lli n,k,z,msum=INT_MIN,idx=0;

     cin>>n>>k>>z;

     lli ans=0;
     lli arr[n+100]={0};
     for(lli i=1;i<=n;i++)
     {
          cin>>arr[i];
     }

     for(lli i=1;i<=(k+1);i++)
     {
          ans=ans+arr[i];

          if(i<=k)
          {
               if((arr[i]+arr[i+1])>msum)
               {
                    msum=arr[i]+arr[i+1];
                    idx=i;
               }
          }
     }
     if(z==0)
     {
          cout<<ans;
          return;
     }
     for(lli tz=1;tz<=z;tz++)
     {
          lli tans=0,tk=k,tidx=idx;
          for(lli i=1;i<=tidx+1;i++)
          {
                tans=tans+arr[i];
          }

          tk=tk-tidx;

        //   print(tz)
            lli et=tz;
          while(et)
          {
              et--;

              if(tk)
              {
                    tans=tans+arr[tidx];
                    tk--;
              }
              if(et&&tk)
              {
                    tk--;
                    tans=tans+arr[tidx+1];
              }
          }

          tidx++;
          while(tk)
          {
              tk--;
              tans=tans+arr[tidx];
              tidx++;
          }

          ans=max(ans,tans);

     }

cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{
     lli n,k,z,msum=INT_MIN,idx=0;

     cin>>n>>k>>z;

     lli ans=0;
     lli arr[n+100]={0};
     for(lli i=1;i<=n;i++)
     {
          cin>>arr[i];
     }

     for(lli i=1;i<=(k+1);i++)
     {
          ans=ans+arr[i];

          if(i<=k)
          {
               if((arr[i]+arr[i+1])>msum)
               {
                    msum=arr[i]+arr[i+1];
                    idx=i;
               }
          }
     }
     if(z==0)
     {
          cout<<ans;
          return ;
     }
     if(((2*z)-1)<=(k-idx))
     {
           ans=0;
          for(lli i=1;i<=idx+1;i++)
          {
                ans=ans+arr[i];
          }

          k=k-idx;

          while(z)
          {
               if(k)
               {
                    ans=ans+arr[idx];
                    k--;
               }
               z--;
               if(k&&z)
               {
                    k--;
                    ans=ans+arr[idx+1];
               }
          }

          idx++;
          while(k)

          {
               k--;
               ans=ans+arr[idx];
               idx++;
          }

          cout<<ans;

     }
     else
     {
          ans=0;

          for(lli i=1;i<=idx+1;i++)
          {
               ans=ans+arr[i];
          }

          if((k-idx)%2)
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
               ans=ans+arr[idx];
          }
          else
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
          }

          cout<<ans;
          return ;
     }

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{
     lli n,k,z,msum=INT_MIN,idx=0;

     cin>>n>>k>>z;

     lli ans=0;
     lli arr[n+100]={0};
     for(lli i=1;i<=n;i++)
     {
          cin>>arr[i];
     }

     for(lli i=1;i<=(k+1);i++)
     {
          ans=ans+arr[i];

          if(i<=k)
          {
               if(arr[i]+arr[i+1]>msum)
               {
                    msum=arr[i]+arr[i+1];
                    idx=i;
               }
          }
     }
     if(z==0)
     {
          cout<<ans;
          return ;
     }
     if((2*z)<=(k-idx))
     {
           ans=0;
          for(lli i=1;i<=idx+1;i++)
          {
                ans=ans+arr[i];
          }

          k=k-idx;

          while(z)
          {
               if(k)
               {
                    ans=ans+arr[idx];
                    k--;
               }
               z--;
               if(k&&z)
               {
                    k--;
                    ans=ans+arr[idx+1];
               }
          }

          idx++;
          while(k)

          {
               k--;
               ans=ans+arr[idx];
          }

          cout<<ans;

     }
     else
     {
          ans=0;

          for(lli i=1;i<=idx+1;i++)
          {
               ans=ans+arr[i];
          }

          if((k-idx)%2)
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
               ans=ans+arr[idx];
          }
          else
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
          }

          cout<<ans;
     }

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][6][2];//this is classic  dp question where (s,k,(0,1)) s is index and k tells me about the number of
//  I have taken  and the third part is to  tell me wheather last step was left or not
lli a[S];
lli cache(lli idx,lli left,lli last,lli moves)
{
    if(moves==k)
    {
        return a[idx];
    }

    if(dp[idx][left][last]!=-1)
    return dp[idx][left][last];

     dp[idx][left][last]=a[idx]+cache( idx+1, left, 0, moves+1);

     if(last==0&&left+1<=z)
     {
        dp[idx][left][last]=max(dp[idx][left][last],a[idx]+cache( idx-1, left+1, 1, moves+1));
     }

     return dp[idx][left][last];

}

void solve()
{
    cin>>n>>k>>z;

    for(lli i=0;i<=n;i++)
    {
        for(lli j=0;j<=k;j++)
        {
            for(lli l=0;l<=1;l++)
            {
                dp[i][j][l]=-1;
            }
        }
    }

    for(lli i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    lli ans=cache(1,0,1,0);

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100001
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (lli)(x.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][6][2];
lli arr[S];
lli cache(lli idx,lli mv,lli lft,lli prev)
{
    // print4(idx,mv,lft,prev)
    if(mv<0)
        return 0;

    lli &ans=dp[idx][lft][prev];
    if(ans!=-1)
        return ans;

    ans=0;
    if(prev==0)//right
    {
        // print(idx)
        ans=(arr[idx]+cache(idx+1,mv-1,lft,0));
        if(lft>=1)
        {
            ans=max(ans,arr[idx]+cache(idx-1,mv-1,lft-1,1));
        }
    }
    else
    {
        // print(idx)
        ans=(arr[idx]+cache(idx+1,mv-1,lft,0));
    }

    return ans;

}
void solve()
{

    cin>>n>>k>>z;

    for(lli i=1;i<=n;i++)
    {
        cin>>arr[i];
        for(lli j=0;j<6;j++)
        {
            dp[i][j][0]=dp[i][j][1]=-1;
        }
    }

    lli ans=0;

    ans=max(ans,cache(1,k,z,1));

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcnt(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{
     lli n,k,z,msum=INT_MIN,idx=0;

     cin>>n>>k>>z;

     lli ans=0;
     lli arr[n+100]={0};
     for(lli i=1;i<=n;i++)
     {
          cin>>arr[i];
     }

     for(lli i=1;i<=(k+1);i++)
     {
          ans=ans+arr[i];

          if(i<=k)
          {
               if((arr[i]+arr[i+1])>=msum)
               {
                    msum=arr[i]+arr[i+1];
                    idx=i;
               }
          }
     }
     if(z==0)
     {
          cout<<ans;
          return;
     }
     for(lli tz=1;tz<=z;tz++)
     {
          lli tans=0,tk=k,tidx=idx;
          for(lli i=1;i<=tidx+1;i++)
          {
                tans=tans+arr[i];
          }

          tk=tk-tidx;

        //   print(tz)
            lli et=tz;
          while(et)
          {
              et--;

              if(tk)
              {
                    tans=tans+arr[tidx];
                    tk--;
              }
              if(et&&tk)
              {
                    tk--;
                    tans=tans+arr[tidx+1];
              }
          }

          tidx++;
          while(tk)
          {
              tk--;
              tans=tans+arr[tidx];
              tidx++;
          }

          ans=max(ans,tans);

     }

cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100005
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][6][2];//this is classic  dp question where (s,k,(0,1)) s is index and k tells me about the number of
//  I have taken  and the third part is to  tell me wheather last step was left or not
lli a[S];
lli cache(lli idx,lli left,lli last,lli moves)
{
    if(moves==k)
    {
        return a[idx];
    }

    if(dp[idx][left][last]!=-1)
    return dp[idx][left][last];

     dp[idx][left][last]=a[idx]+cache( idx+1, left, 0, moves+1);

     if(last==0&&left+1<=z)
     {
        dp[idx][left][last]=max(dp[idx][left][last],a[idx]+cache( idx-1, left+1, 1, moves+1));
     }

     return dp[idx][left][last];

}

void solve()
{
    cin>>n>>k>>z;

    for(lli i=0;i<=n;i++)
    {
        for(lli j=0;j<=5;j++)
        {
            for(lli l=0;l<=1;l++)
            {
                dp[i][j][l]=-1;
            }
        }
    }

    for(lli i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    lli ans=cache(1,0,1,0);

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}//gkm
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{
     lli n,k,z,msum=INT_MIN,idx=0;

     cin>>n>>k>>z;

     lli ans=0;
     lli arr[n+100]={0};
     for(lli i=1;i<=n;i++)
     {
          cin>>arr[i];
     }

     for(lli i=1;i<=(k+1);i++)
     {
          ans=ans+arr[i];

          if(i<=k)
          {
               if((arr[i]+arr[i+1])>msum)
               {
                    msum=arr[i]+arr[i+1];
                    idx=i;
               }
          }
     }
     if(z==0)
     {
          cout<<ans;
          return ;
     }
     if(((2*z)-1)<=(k-idx))
     {
           ans=0;
          for(lli i=1;i<=idx+1;i++)
          {
                ans=ans+arr[i];
          }

          k=k-idx;

          while(z)
          {
               if(k)
               {
                    ans=ans+arr[idx];
                    k--;
               }
               z--;
               if(k&&z)
               {
                    k--;
                    ans=ans+arr[idx+1];
               }
          }

          idx++;
          while(k)

          {
               k--;
               ans=ans+arr[idx];
          }

          cout<<ans;

     }
     else
     {
          ans=0;

          for(lli i=1;i<=idx+1;i++)
          {
               ans=ans+arr[i];
          }

          if((k-idx)%2)
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
               ans=ans+arr[idx];
          }
          else
          {
               ans=ans+(arr[idx]+arr[idx+1])*((k-idx)/2);
          }

          cout<<ans;
     }

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100005
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (lli)(x.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][6][6][3];
lli arr[S];
lli cache(lli idx,lli mv,lli lft,lli prev)
{
    // print4(idx,mv,lft,prev)
    if(mv<0)
        return 0;

    lli &ans=dp[idx][mv][lft][prev];
    if(ans!=-1)
        return ans;

    ans=0;
    if(prev==1)//right
    {
        // print(idx)
        ans=(arr[idx]+cache(idx+1,mv-1,lft,1));
        if(lft>=1)
        {
            ans=max(ans,arr[idx]+cache(idx-1,mv-1,lft-1,2));
        }
    }
    else
    {
        // print(idx)
        ans=(arr[idx]+cache(idx+1,mv-1,lft,1));
    }

    return ans;

}
void solve()
{

    cin>>n>>k>>z;
    memset(dp,-1,sizeof(dp));
    for(lli i=1;i<=n;i++)
    {
        cin>>arr[i];
    }

    lli ans=0;

    ans=max(ans,cache(1,k,z,2));

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcnt(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100001
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (lli)(x.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][6][2];
lli arr[S];
lli cache(lli idx,lli mv,lli lft,lli prev)
{
    // print4(idx,mv,lft,prev)
    if(mv<0)
        return 0;

    lli &ans=dp[idx][lft][prev];
    if(ans!=-1)
        return ans;

    ans=0;
    if(prev==0)//right
    {
        // print(idx)
        ans=(arr[idx]+cache(idx+1,mv-1,lft,0));
        if(lft>=1)
        {
            ans=max(ans,arr[idx]+cache(idx-1,mv-1,lft-1,1));
        }
    }
    else
    {
        // print(idx)
        ans=(arr[idx]+cache(idx+1,mv-1,lft,0));
    }

    return ans;

}
void solve()
{

    cin>>n>>k>>z;
    memset(dp,-1,sizeof(dp));
    for(lli i=1;i<=n;i++)
    {
        cin>>arr[i];
    }

    lli ans=0;

    ans=max(ans,cache(1,k,z,1));

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcnt(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000055
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][7][2];//this is classic  dp question where (s,k,(0,1)) s is index and k tells me about the number of
//  I have taken  and the third part is to  tell me wheather last step was left or not
lli a[S];
lli cache(lli idx,lli left,lli last,lli moves)
{
    if(moves==k)
    {
        return a[idx];
    }

    if(dp[idx][left][last]!=-1)
    return dp[idx][left][last];

    dp[idx][left][last]=INT_MIN;

     dp[idx][left][last]=a[idx]+cache( idx+1, left, 0, moves+1);

     if(last==0&&left+1<=z)
     {
        dp[idx][left][last]=max(dp[idx][left][last],a[idx]+cache( idx-1, left+1, last^1, moves+1));
     }

     return dp[idx][left][last];

}

void solve()
{
    cin>>n>>k>>z;

    for(lli i=1;i<=n;i++)
    {
        for(lli j=0;j<=k;j++)
        {
            for(lli l=0;l<=1;l++)
            {
                dp[i][j][l]=-1;
            }
        }
    }

    for(lli i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    lli ans=cache(1,0,1,0);

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";


//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100005
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
lli n,k,z;
lli dp[S][6][2];//this is classic  dp question where (s,k,(0,1)) s is index and k tells me about the number of
//  I have taken  and the third part is to  tell me wheather last step was left or not
lli a[S];
lli cache(lli idx,lli left,lli last,lli moves)
{
    if(moves==k)
    {
        return a[idx];
    }

    if(dp[idx][left][last]!=-1)
    return dp[idx][left][last];

     dp[idx][left][last]=a[idx]+cache( idx+1, left, 0, moves+1);

     if(last==0&&left+1<=z)
     {
        dp[idx][left][last]=max(dp[idx][left][last],a[idx]+cache( idx-1, left+1, 1, moves+1));
     }

     return dp[idx][left][last];

}

void solve()
{
    cin>>n>>k>>z;

    for(lli i=0;i<=n;i++)
    {
        for(lli j=0;j<=5;j++)
        {
            for(lli l=0;l<=1;l++)
            {
                dp[i][j][l]=-1;
            }
        }
    }

    for(lli i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    lli ans=cache(1,0,1,0);

    cout<<ans;

}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif

     test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";