#include <iostream>
#include<algorithm>
#include<utility>
#include<vector>

using namespace std;

vector<int>  x[50];
bool z[50];

int main()
{
    unsigned long long s=1;
    int n,m,a,b;
    int i,p;
    cin>>n;
    cin>>m;
    for(i=0;i<n;i++) z[i]=false;
    for(i=0;i<m;i++)
    {
        cin>>a;
        cin>>b;
        a--;
        b--;
        x[a].push_back(b);
        x[b].push_back(a);
    }
    bool f;
    z[0]=true;
    p=1;
    while(p!=n)
    {
        a=-1;
        for(i=1;i<n;i++)
        {
            if(!z[i])
            {
                f=true;
                for(size_t j=0;j<x[i].size();j++)
                {
                    if(z[x[i][j]])
                    {
                        p++;
                        s*=2;
                        z[i]=true;
                        j=x[i].size();
                        f=false;
                    }
                }
                if(f)
                {
                    a=i;
                }
            }
        }
        if(a!=-1)
        {
            p++;
            z[a]=true;
        }
    }
    cout<<s;
    return 0;
}


#include <iostream>
#include<algorithm>
#include<utility>
#include<vector>

using namespace std;

vector<int>  x[50];
bool z[50];

int main()
{
    unsigned long long s=1;
    int n,m,a,b;
    int i,p;
    cin>>n;
    cin>>m;
    for(i=0;i<n;i++) z[i]=false;
    for(i=0;i<m;i++)
    {
        cin>>a;
        cin>>b;
        a--;
        b--;
        x[a].push_back(b);
        x[b].push_back(a);
    }
    bool f;
    z[0]=true;
    p=1;
    while(p!=n)
    {
        a=-1;
        for(i=1;i<n;i++)
        {
            if(z[i]==false)
            {
                f=true;
                for(size_t j=0;j<x[i].size();j++)
                {
                    if(z[x[i][j]]==true)
                    {
                        p++;
                        s*=2;
                        z[i]=true;
                        j=x[i].size();
                        f=false;
                    }
                }
                if(f) a=i;
            }
        }
        if(a!=-1)
        {
            p++;
            z[a]=true;
        }
    }
    cout<<s;
    return 0;
}


#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <set>

using namespace std;
const int n_max = 50;

int main()
{
    //freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    long long d = 1;
    int cnt = 0;
    int q = 0, w = 0;
    int a[n_max + 1][n_max + 1] = {};

    for (int i = 0; i < m; i++)
    {
        cin >> q >> w;
        a[q][w]++;
        a[w][q]++;
    }
    vector <int> used(n + 1);
    for (int i = 1; i < n + 1; i++)
    {
        used[i] = 1;
        for (int j = 1; j < n + 1; j++)
        {
            if (a[i][j] == 1)
            {
                if (!used[j])
                {
                    used[j] = 1;
                    d *= 2;
                }
            }
        }
    }
    cout << d << endl;

    return 0;
}


#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <set>

using namespace std;

vector <vector<int> > g;
vector <char> used;

void dfs(int v)
{
    used[v] = 1;
    for (int i = 0; i < g[v].size(); i++)
    {
        int to = g[v][i];
        if (!used[to])
        {
            dfs(to);
        }
    }
}

int main()
{
    //freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    g.resize(n);
    used.resize(n);
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (!used[i])
        {
            dfs(i);
            cnt++;
        }
    }

    cout << (1LL << (n - cnt)) << endl;

    return 0;
}


#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <set>

using namespace std;
const int n_max = 50;
int a[n_max][n_max] = {};

int get(vector <int> &used)
{
    int n = used.size();
    for (int i = 0; i < n; i++)
    {
        if (!used[i])
        {
            for (int j = 0; j < n; j++)
            {
                if (used[j])
                {
                    if (a[i][j])
                    {
                        return i;
                    }
                }
            }
        }
    }
    return -1;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    long long d = 1;
    int cnt = 0;
    int q = 0, w = 0;

    for (int i = 0; i < m; i++)
    {
        cin >> q >> w;
        q--;w--;
        a[q][w]++;
        a[w][q]++;
    }

    vector <int> used(n);

    for (int i = 0; i < n; i++)
    {
        if (!used[i])
        {
            used[i] = 1;
            int p;
            while ((p = get(used)) != -1)
            {
                used[p] = 1;
                d *= 2;
            }
        }
    }

    cout << d << endl;

    return 0;
}


#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <set>

using namespace std;

int main()
{
    //freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    vector <int> v(n + 1);
    int q = 0, w = 0;
    long long d = 1;
    int cnt = 0;
    for (int i = 0; i < m; i++)
    {
        cin >> q >> w;
        v[q]++;
        v[w]++;
    }
    for (int i = 0; i < n; i++)
    {
        if (v[i] > 0 && v[i + 1] > 0)
        {
            cnt++;
            d *= 2;
        }
    }
    cout << d << endl;

    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int f[55],sum;
int find(int x)
{
    if(f[x]!=x)
    {
        f[x]=find(f[x]);
    }
    return f[x];
}

void make(int a,int b)
{
    int f1=find(a);
    int f2=find(b);
    if(f1!=f2)
    {
        f[f2]=f1;
        sum--;
    }
}

int main()
{
    int n,m,i,a,b;
    int c[55];
    while(scanf("%d%d",&n,&m)==2)
    {
        for(i=1;i<=n;i++)
        {
            f[i]=i;
        }
        sum=n;
        for(i=1;i<=m;i++)
        {
            scanf("%d%d",&a,&b);
            make(a,b);
        }
        __int64 maxx=1;
        for(i=1;i<=n-sum;i++)
        {
            maxx=maxx*2;
        }
        printf("%I64d\n",maxx);
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int f[55];
int find(int x)
{
    if(f[x]!=x)
    {
        f[x]=find(f[x]);
    }
    return f[x];
}

void make(int a,int b)
{
    int f1=find(a);
    int f2=find(b);
    if(f1!=f2)
    {
        f[f2]=f1;
        //sum--;
    }
}

int main()
{
    int n,m,i,a,b;
    int c[55];
    while(scanf("%d%d",&n,&m)==2)
    {
        for(i=1;i<=n;i++)
        {
            f[i]=i;
        }
        for(i=1;i<=m;i++)
        {
            scanf("%d%d",&a,&b);
            make(a,b);
        }
        int maxx=1;
        for(i=1;i<=n;i++)
        {
            int d=1;
            for(int j=1;j<=n;j++)
            {
                if(i==j) continue;
                else
                {
                    if(f[i]==f[j])
                    {
                        d=d*2;
                    }
                }
            }
            if(d>maxx)
            {
                maxx=d;
            }
        }
        printf("%d\n",maxx);
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int n,m,i,a,b;
    __int64 sum;
    //int c[55];
    while(scanf("%d%d",&n,&m)==2)
    {
        sum=1;
        for(i=1;i<=m;i++)
        {
            scanf("%d%d",&a,&b);
        }
        for(i=0;i<m;i++)
        {
            sum=sum*2;
        }
        printf("%I64d\n",sum);
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int n,m,i,a,b;
    int c[55];
    while(scanf("%d%d",&n,&m)==2)
    {
        for(i=1;i<=n;i++)
        {
            c[i]=1;
        }
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&a,&b);
            c[a]=c[a]*2;
            c[b]=c[b]*2;
        }
        sort(c+1,c+n+1);
        printf("%d\n",c[n]);
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int f[55],sum;
int find(int x)
{
    if(f[x]!=x)
    {
        f[x]=find(f[x]);
    }
    return f[x];
}

void make(int a,int b)
{
    int f1=find(a);
    int f2=find(b);
    if(f1!=f2)
    {
        f[f2]=f1;
        sum--;
    }
}

int main()
{
    int n,m,i,a,b;
    int c[55];
    while(scanf("%d%d",&n,&m)==2)
    {
        for(i=1;i<=n;i++)
        {
            f[i]=i;
        }
        sum=n;
        for(i=1;i<=m;i++)
        {
            scanf("%d%d",&a,&b);
            make(a,b);
        }
        int maxx=1;
        for(i=1;i<=n-sum;i++)
        {
            maxx=maxx*2;
        }
        printf("%d\n",maxx);
    }
    return 0;
}


#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <cmath>
#include <complex>
#include <stack>
#include <string>
#include <cstring>
#include "time.h"
using namespace std;
#define SZ(x) (int)x.size()
#define FOR(i,x,y) for(int i=(int)(x);i<=(int)(y);++i)
#define REP(i,n) FOR(i,0,n-1)
#define FORD(i,x,y) for(int i=(int)(x);i>=(int)(y);--i)
#define ALL(a) (a).begin(),(a).end()
#define FORE(i,t) for(i=t.begin();i!=t.end();++i)
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef deque<int> DI;
typedef deque<string> DS;
typedef long long i64;
#define PI 3.14159265358979323
#define DEGTORAD(x) (double)x * 3.14159265358979323846264338327950288 / 180.0
#define RADTODEG(x) (double)x * 180 / 3.14159265358979323846264338327950288
#define prt if(1)printf
typedef pair< int, int > PII;
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }
#define ARRTOV(a,v) (v.assign(a,a+sizeof(a)/sizeof(a[0])))
#define SAFEMOD(a,b) (((a%b)+b)%b)
#define SQR(x) ((x)*(x))
#define EPS 1e-9
#define POW(x,y) pow((double)(x),(double)(y))
#define LL_MAX 9223372036854775807LL

int N,M;
bool adj[55][55];
bool vis[55];
int C;

void dfs(int at) {
  if (vis[at])
    return;
  vis[at] = true;
  ++C;
  REP(i,N) {
    if (i == at)
      continue;
    if (adj[at][i])
      dfs(i);
  }
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("254_B.in","r", stdin);
#endif

  cin>>N>>M;

  memset(adj,false,sizeof adj);
  REP(i,M) {
    int a,b;
    cin>>a>>b;
    --a;
    --b;
    adj[a][b] = true;
    adj[b][a] = true;
  }

  i64 ans = 0;
  REP(i,N) {
    memset(vis,false,sizeof vis);
    C = 0;
    dfs(i);
    i64 v = POW(2,C-1);
    ans = max(v,ans);
  }
  cout<<ans;

  return 0;
}


#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <cmath>
#include <complex>
#include <stack>
#include <string>
#include <cstring>
#include "time.h"
using namespace std;
#define SZ(x) (int)x.size()
#define FOR(i,x,y) for(int i=(int)(x);i<=(int)(y);++i)
#define REP(i,n) FOR(i,0,n-1)
#define FORD(i,x,y) for(int i=(int)(x);i>=(int)(y);--i)
#define ALL(a) (a).begin(),(a).end()
#define FORE(i,t) for(i=t.begin();i!=t.end();++i)
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef deque<int> DI;
typedef deque<string> DS;
typedef long long i64;
#define PI 3.14159265358979323
#define DEGTORAD(x) (double)x * 3.14159265358979323846264338327950288 / 180.0
#define RADTODEG(x) (double)x * 180 / 3.14159265358979323846264338327950288
#define prt if(1)printf
typedef pair< int, int > PII;
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }
#define ARRTOV(a,v) (v.assign(a,a+sizeof(a)/sizeof(a[0])))
#define SAFEMOD(a,b) (((a%b)+b)%b)
#define SQR(x) ((x)*(x))
#define EPS 1e-9
#define POW(x,y) pow((double)(x),(double)(y))
#define LL_MAX 9223372036854775807LL

int N,M;
bool adj[55][55];
bool vis[55];
int C;

void dfs(int at) {
  if (vis[at])
    return;
  vis[at] = true;
  ++C;
  REP(i,N) {
    if (i == at)
      continue;
    if (adj[at][i])
      dfs(i);
  }
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("254_B.in","r", stdin);
#endif

  cin>>N>>M;

  memset(adj,false,sizeof adj);
  REP(i,M) {
    int a,b;
    cin>>a>>b;
    --a;
    --b;
    adj[a][b] = true;
    adj[b][a] = true;
  }

  i64 ans = 0;
  int cnt = 0;
  memset(vis,false,sizeof vis);
  REP(i,N) {
    if (vis[i])
      continue;
    C = 0;
    dfs(i);
    ans += POW(2,C-1);
  }
  cout<<ans;

  return 0;
}


#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <cmath>
#include <complex>
#include <stack>
#include <string>
#include <cstring>
#include "time.h"
using namespace std;
#define SZ(x) (int)x.size()
#define FOR(i,x,y) for(int i=(int)(x);i<=(int)(y);++i)
#define REP(i,n) FOR(i,0,n-1)
#define FORD(i,x,y) for(int i=(int)(x);i>=(int)(y);--i)
#define ALL(a) (a).begin(),(a).end()
#define FORE(i,t) for(i=t.begin();i!=t.end();++i)
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef deque<int> DI;
typedef deque<string> DS;
typedef long long i64;
#define PI 3.14159265358979323
#define DEGTORAD(x) (double)x * 3.14159265358979323846264338327950288 / 180.0
#define RADTODEG(x) (double)x * 180 / 3.14159265358979323846264338327950288
#define prt if(1)printf
typedef pair< int, int > PII;
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }
#define ARRTOV(a,v) (v.assign(a,a+sizeof(a)/sizeof(a[0])))
#define SAFEMOD(a,b) (((a%b)+b)%b)
#define SQR(x) ((x)*(x))
#define EPS 1e-9
#define POW(x,y) pow((double)(x),(double)(y))
#define LL_MAX 9223372036854775807LL

int N,M;
bool adj[55][55];
bool vis[55];

void dfs(int at) {
  if (vis[at])
    return;
  vis[at] = true;
  REP(i,N) {
    if (i == at)
      continue;
    if (adj[at][i])
      dfs(i);
  }
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("254_B.in","r", stdin);
#endif

  cin>>N>>M;

  memset(adj,false,sizeof adj);
  REP(i,M) {
    int a,b;
    cin>>a>>b;
    --a;
    --b;
    adj[a][b] = true;
    adj[b][a] = true;
  }

  i64 ans = 0;
  int cnt = 0;
  memset(vis,false,sizeof vis);
  REP(i,N) {
    if (vis[i])
      continue;
    ++cnt;
    dfs(i);
  }
  ans = POW(2,N - cnt);
  cout<<ans;

  return 0;
}


#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <cmath>
#include <complex>
#include <stack>
#include <string>
#include <cstring>
#include "time.h"
using namespace std;
#define SZ(x) (int)x.size()
#define FOR(i,x,y) for(int i=(int)(x);i<=(int)(y);++i)
#define REP(i,n) FOR(i,0,n-1)
#define FORD(i,x,y) for(int i=(int)(x);i>=(int)(y);--i)
#define ALL(a) (a).begin(),(a).end()
#define FORE(i,t) for(i=t.begin();i!=t.end();++i)
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef deque<int> DI;
typedef deque<string> DS;
typedef long long i64;
#define PI 3.14159265358979323
#define DEGTORAD(x) (double)x * 3.14159265358979323846264338327950288 / 180.0
#define RADTODEG(x) (double)x * 180 / 3.14159265358979323846264338327950288
#define prt if(1)printf
typedef pair< int, int > PII;
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }
#define ARRTOV(a,v) (v.assign(a,a+sizeof(a)/sizeof(a[0])))
#define SAFEMOD(a,b) (((a%b)+b)%b)
#define SQR(x) ((x)*(x))
#define EPS 1e-9
#define POW(x,y) pow((double)(x),(double)(y))
#define LL_MAX 9223372036854775807LL

int N,M;
struct typex {
  int ndx;
  VI react;
};

struct Compare {
  bool operator() (const typex& x1, const typex& x2) {
    if (SZ(x1.react) != SZ(x2.react))
      return SZ(x1.react) > SZ(x2.react);
    return x1.ndx < x2.ndx;
  };
};

int main() {
#ifndef ONLINE_JUDGE
  freopen("254_B.in","r", stdin);
#endif

  cin>>N>>M;
  vector< typex > d;
  REP(i,N) {
    typex x;
    x.ndx = i;
    d.push_back(x);
  }
  REP(i,M) {
    int a,b;
    cin>>a>>b;
    --a;
    --b;
    d[a].react.push_back(b);
    d[b].react.push_back(a);
  }
  sort(ALL(d),Compare());
  i64 ans = 1;
  set< int > have;
  REP(i,SZ(d)) {
    bool react = false;
    REP(j,SZ(d[i].react)) {
      if (have.count(d[i].react[j])) {
        react = true;
        break;
      }
    }
    if (react)
      ans *= 2ll;
    have.insert(d[i].ndx);
  }

  cout<<ans;

  return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, ans = 0, tmp;
bool p[51][51];
bool u[51];
int d[51];
queue <int> Q;

void bfs(int v)
{
	Q.push(v);
	while (!Q.empty())
	{
		v = Q.front();
		u[v] = true;
		Q.pop();
		for (int i = 1; i <= n; ++i)
		{
			if (!u[i] && p[v][i])
			{
				d[i] = d[v] + 1;
				Q.push(i);
			}
		}
	}
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
	{
		memset(u, false, sizeof u);
		memset(d, 0, sizeof d);
		tmp = 0;
		bfs(i);
		for (int k = 1; k <= n; ++k)
			tmp = max(tmp, d[k]);
		for (int j = 1; j <= n; ++j)
		{
			if (!u[j])
			{
				memset(d, 0, sizeof d);
				bfs(j);
				int newtmp = 0;
				for (int k = 1; k <= n; ++k)
					newtmp = max(newtmp, d[k]);
				tmp += newtmp;
			}
		}
		ans = max(ans, tmp);
	}
	long long dan = 1;
	for (int i = 0; i < ans; ++i)
		dan *= 2;
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, ans = 0, tmp;
bool p[51][51];
bool u[51];
int d[51];
queue <int> Q;

void bfs(int v)
{
	Q.push(v);
	while (!Q.empty())
	{
		v = Q.front();
		u[v] = true;
		Q.pop();
		for (int i = 1; i <= n; ++i)
		{
			if (!u[i] && p[v][i])
			{
				d[i] = d[v] + 1;
				Q.push(i);
			}
		}
	}
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
	{
		memset(u, false, sizeof u);
		memset(d, 0, sizeof d);
		tmp = 0;
		bfs(i);
		for (int k = 1; k <= n; ++k)
			tmp = max(tmp, d[k]);
		for (int j = 1; j <= n; ++j)
		{
			if (!u[j])
			{
				memset(d, 0, sizeof d);
				bfs(j);
				int newtmp;
				for (int k = 1; k <= n; ++k)
					newtmp = max(newtmp, d[k]);
				tmp += newtmp;
			}
		}
		ans = max(ans, tmp);
	}
	long long dan = 1;
	for (int i = 0; i < ans; ++i)
		dan *= 2;
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, ans = 0, tmp;
bool p[51][51];
bool u[51];
int d[51];
int c[51], comp = 0;
int tmpans[51];

void dfs(int v)
{
	u[v] = true;
	c[v] = comp;
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
			dfs(i);
	}
}

int find_long_path(int v)
{
	u[v] = true;
	int ans = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (p[v][i] && !u[i])
			ans = max(ans, find_long_path(i) + 1);
	}
	u[v] = false;
	return ans;
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
		if (!u[i])
		{
			dfs(i);
			++comp;
		}
	memset(tmpans, 0, sizeof tmpans);
	for (int i = 1; i <= n; ++i)
	{
		tmpans[c[i]] = find_long_path(i);
	}
	for (int i = 0; i < comp; ++i)
		ans += tmpans[i];
	long long dan = 1;
	for (int i = 0; i < ans; ++i)
		dan *= 2;
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, ans = 0, tmp;
bool p[51][51];
bool u[51];
int d[51];

void dfs(int v)
{
	u[v] = true;
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
		{
			d[i] = d[v] + 1;
			dfs(i);
		}
	}
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
	{
		memset(u, false, sizeof u);
		memset(d, 0, sizeof d);
		tmp = 0;
		dfs(i);
		for (int k = 1; k <= n; ++k)
			tmp = max(tmp, d[k]);
		for (int j = 1; j <= n; ++j)
		{
			if (!u[j])
			{
				memset(d, 0, sizeof d);
				dfs(j);
				int newtmp;
				for (int k = 1; k <= n; ++k)
					newtmp = max(newtmp, d[k]);
				tmp += newtmp;
			}
		}
		ans = max(ans, tmp);
	}
	long long dan = 1;
	for (int i = 0; i < ans; ++i)
		dan *= 2;
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, ans = 0, tmp;
bool p[51][51];
bool u[51];
int d[51];

void dfs(int v)
{
	u[v] = true;
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
		{
			d[i] = d[v] + 1;
			dfs(i);
		}
	}
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
	{
		memset(u, false, sizeof u);
		memset(d, 0, sizeof d);
		tmp = 0;
		dfs(i);
		for (int k = 1; k <= n; ++k)
			tmp = max(tmp, d[k]);
		for (int j = 1; j <= n; ++j)
		{
			if (!u[j])
			{
				memset(d, 0, sizeof d);
				dfs(j);
				int newtmp = 0;
				for (int k = 1; k <= n; ++k)
					newtmp = max(newtmp, d[k]);
				tmp += newtmp;
			}
		}
		ans = max(ans, tmp);
	}
	long long dan = 1;
	for (int i = 0; i < ans; ++i)
		dan *= 2;
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, ans = 0, tmp;
bool p[51][51];
bool u[51];
int d[51];
int c[51], comp = 0;
int tmpans[51];

void dfs(int v)
{
	u[v] = true;
	c[v] = comp;
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
			dfs(i);
	}
}

void dfs2(int v)
{
	u[v] = true;
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
		{
			d[i] = d[v] + 1;
			dfs2(i);
		}
	}
}

queue <int> Q;

void bfs(int v)
{
	Q.push(v);
	memset(u, false, sizeof u);
	memset(d, 0, sizeof d);
	while (!Q.empty())
	{
		v = Q.front();
		Q.pop();
		u[v] = true;
		for (int i = 1; i <= n; ++i)
		{
			if (!u[i] && p[v][i])
			{
				d[i] = d[v] + 1;
				Q.push(i);
			}
		}
	}
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
		if (!u[i])
		{
			dfs(i);
			++comp;
		}
	memset(tmpans, 0, sizeof tmpans);
	for (int i = 1; i < n; ++i)
	{
		for (int j = i + 1; j <= n; ++j)
		{
			if (c[i] == c[j])
			{
				memset(u, false, sizeof u);
				memset(d, 0, sizeof d);
				dfs2(i);
				tmpans[c[i]] = max(tmpans[c[i]], d[j]);
			}
		}
	}
	for (int i = 0; i < comp; ++i)
		ans += tmpans[i];
	long long dan = 1;
	for (int i = 0; i < ans; ++i)
		dan *= 2;
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, tmp;
bool p[51][51];
bool u[51];
int d[51];
int c[51], comp = 0;
int tmpans[51];

void dfs(int v)
{
	u[v] = true;
	c[v] = comp;
	++tmpans[c[v]];
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
			dfs(i);
	}
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i])
		{
			dfs(i);
			++comp;
		}
	}
	long long dan = 1;
	for (int i = 0; i < comp; ++i)
	{
		for (int j = 0; j < tmpans[i] - 1; ++j)
			dan *= 2;
	}
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, ans = 0;
bool p[51][51];
bool u[51];
int d[51];

void dfs(int v)
{
	u[v] = true;
	ans = max(ans, d[v]);
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
		{
			d[i] = d[v] + 1;
			dfs(i);
		}
	}
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
	{
		memset(u, false, sizeof u);
		memset(d, 0, sizeof d);
		dfs(i);
	}
	long long dan = 1;
	for (int i = 0; i < ans; ++i)
		dan *= 2;
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

#define MOD 1000000007
#define INF 1000000000
#define EPS 1e-9
#define HASH_POW 31
const double PI = acos(-1.0);

using namespace std;

int n, m, tmp;
bool p[51][51];
bool u[51];
int d[51];
int c[51], comp = 0;
int tmpans[51];

void dfs(int v)
{
	u[v] = true;
	c[v] = comp;
	for (int i = 1; i <= n; ++i)
	{
		if (!u[i] && p[v][i])
			dfs(i);
	}
}

int find_long_path(int v)
{
	u[v] = true;
	int ans = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (p[v][i] && !u[i])
			ans = max(ans, find_long_path(i) + 1);
	}
	u[v] = false;
	return ans;
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("sum.in", "rt", stdin);
	//freopen("sum.out", "wt", stdout);
	#endif

	scanf("%d %d\n", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		p[x][y] = p[y][x] = true;
	}
	for (int i = 1; i <= n; ++i)
		if (!u[i])
		{
			dfs(i);
			++comp;
		}
	memset(tmpans, 0, sizeof tmpans);
	for (int i = 1; i <= n; ++i)
		tmpans[c[i]] = find_long_path(i);
	long long dan = 1;
	for (int i = 0; i < comp; ++i)
	{
		for (int j = 0; j < tmpans[i]; ++j)
			dan *= 2;
	}
	printf("%I64d", dan);

	#ifdef MYDEBUG
		cout << "\nTime = " << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	return 0;
}


#include <iostream>
#include <limits.h>
#include <utility>
#include <fstream>
#include <string>
#include <string.h>
#include <functional>
#include <queue>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>

typedef long long ll;
bool relation[51][51];
using namespace std;
bool chem[51];
int main(){
#ifdef _CONSOLE
    freopen("input.txt", "r", stdin);
#endif
    int n, m;
    cin >> n >> m;
    int mul=1;
    int a, b;
    for (int i = 0; i < m; i++)
    {
        cin >> a >> b;
        if (!chem[a]){
            chem[a] = true;
            mul *= 2;
        }
        if (!chem[b]) {
            chem[b] = true;
            mul *= 2;
        }
    }
    mul /= 2;
    if (mul == 0)
        cout << "1" << endl;
    else
        cout << mul << endl;
}


#include <iostream>
#include <limits.h>
#include <utility>
#include <fstream>
#include <string>
#include <string.h>
#include <functional>

#include <queue>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>

typedef long long ll;

using namespace std;
int n, m;
vector<bool> visited;
ll ans = 1;
vector<vector<int> > graph;

void dfs(int here){
    for (int i = 0; i < graph[here].size(); i++){
        int there = graph[here][i];
        if (!visited[there]){
            ans *= 2;
            visited[there] = true;
            dfs(there);
        }
    }
}

int main(){
#ifdef _CONSOLE
    freopen("input.txt", "r", stdin);
#endif
    cin >> n >> m;
    visited.resize(n + 1, false);
    graph.resize(n + 1);
    for (int i = 0; i < m; i++){
        int t1, t2;
        cin >> t1 >> t2;
        graph[t1].push_back(t2);
        graph[t2].push_back(t1);
    }
    for (int i = 1; i <= n; i++){
        if (!visited[i]){
            visited[i] = true;
            dfs(i);
        }
    }
    cout << ans << endl;
}


#include <iostream>
#include <limits.h>
#include <utility>
#include <fstream>
#include <string>
#include <string.h>
#include <functional>
#include <queue>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>

typedef long long ll;
bool relation[51][51];
using namespace std;
bool chem[51];
int main(){
#ifdef _CONSOLE
    freopen("input.txt", "r", stdin);
#endif
    int n, m;
    cin >> n >> m;
    int mul=1;
    int a, b;
    for (int i = 0; i < m; i++)
    {
        cin >> a >> b;
        if (!chem[a]){
            chem[a] = true;
            mul *= 2;
        }
        if (!chem[b]) {
            chem[b] = true;
            mul *= 2;
        }
    }
    mul /= 2;
    cout << mul << endl;
}


#include <iostream>
#include <limits.h>
#include <utility>
#include <fstream>
#include <string>
#include <string.h>
#include <functional>
#include <queue>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>

typedef long long ll;
bool relation[51][51];
using namespace std;
bool chem[51];
int main(){
#ifdef _CONSOLE
    freopen("input.txt", "r", stdin);
#endif
    int n, m;
    cin >> n >> m;
    ll mul=1;
    int a, b;
    for (int i = 0; i < m; i++)
    {
        cin >> a >> b;
        chem[a] = true;
        chem[b] = true;
    }
    for (int i = 1; i <= n; i++){
        if (chem[i])
            mul *= 2;
    }
    if (mul / 2 == 0)
        cout << "1" << endl;
    else
        cout << mul / 2<< endl;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll ;
#pragma comment(linker, "/STACK:16777216")
struct tube{
	int v,o;
};
	int n,m;
	bool a[50][50];
	bool used[50];
	tube b[50];
	int ans;

bool comp(tube a,tube b ){
	return a.v>b.v;
}
void bfs(int start_node){
	used[start_node]=true;
	ans+=1;
	for(int i=0;i<n;i++){
		if(!used[i])
		if(a[start_node][i]){
			bfs(i);
		}
	}
}
int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
	ans=0;

	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++){
		a[i][j]=false;
		b[j].v=0;
		b[j].o=j;
		used[i]=false;
		}
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		a[u-1][v-1]=1;a[v-1][u-1]=1;
		b[u-1].v++;
		b[v-1].v++;

	}
	sort(b,b+n,comp);
	for (int i=0;i<n;i++){
		if(!used[b[i].o]){
			ans--;
			bfs(b[i].o);
		}
	}
	int pow=1;
	for (int i=0;i<ans;i++)
		pow*=2;
	cout<<pow;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll ;
#pragma comment(linker, "/STACK:16777216")
struct tube{
	int v,o;
};
	int n,m;
	bool a[50][50];
	bool used[50];
	tube b[50];
	int ans;

bool comp(tube a,tube b ){
	return a.v>b.v;
}
void bfs(int start_node){
	used[start_node]=true;
	ans+=1;
	for(int i=0;i<n;i++){
		if(!used[i])
		if(a[start_node][i]){
			bfs(i);
		}
	}
}
int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
	ans=0;

	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++){
		a[i][j]=false;
		b[j].v=0;
		b[j].o=j;
		used[i]=false;
		}
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		a[u-1][v-1]=1;a[v-1][u-1]=1;
		b[u-1].v++;
		b[v-1].v++;

	}

	for (int i=0;i<n;i++){
		if(!used[b[i].o]){
			ans--;
			bfs(b[i].o);
		}
	}
	long long pow=1;
	for (int i=0;i<ans;i++)
		pow*=2;
	cout<<pow;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll ;
#pragma comment(linker, "/STACK:16777216")
struct tube{
	int v,o;
};
	int n,m;
	bool a[50][50];
	bool used[50];
	tube b[50];
	int ans;

bool comp(tube a,tube b ){
	return a.v>b.v;
}
void bfs(int start_node){
	used[start_node]=true;
	ans*=2;
	for(int i=0;i<n;i++){
		if(!used[i])
		if(a[start_node][i]){
			bfs(i);
		}
	}
}
int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
	ans=2;

	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++){
		a[i][j]=false;
		b[j].v=0;
		b[j].o=j;
		used[i]=false;
		}
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		a[u-1][v-1]=1;a[v-1][u-1]=1;
		b[u-1].v++;
		b[v-1].v++;

	}
	sort(b,b+n,comp);
	for (int i=0;i<n;i++){
		if(!used[b[i].o]){
			ans/=2;
			bfs(b[i].o);
		}
	}
	cout<<ans/2;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll ;
#pragma comment(linker, "/STACK:16777216")
struct tube{
	int v,o;
};
	int n,m;
	bool a[50][50];
	bool used[50];
	tube b[50];
	int ans;

bool comp(tube a,tube b ){
	return a.v>b.v;
}
void bfs(int start_node){
	used[start_node]=true;
	ans+=1;
	for(int i=0;i<n;i++){
		if(!used[i])
		if(a[start_node][i]){
			bfs(i);
		}
	}
}
int main()
{
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
	ans=0;

	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++){
		a[i][j]=false;
		b[j].v=0;
		b[j].o=j;
		used[i]=false;
		}
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		a[u-1][v-1]=1;a[v-1][u-1]=1;
		b[u-1].v++;
		b[v-1].v++;

	}

	for (int i=0;i<n;i++){
		if(!used[b[i].o]){
			ans--;
			bfs(b[i].o);
		}
	}
	int pow=1;
	for (int i=0;i<ans;i++)
		pow*=2;
	cout<<pow;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;

int n,m;

bool graph[55][55];

bool visited[55];

int dfs(int st){
	visited[st] = true;
	int ret = 0;
	for(int i=1; i<=n; i++)
		if(graph[st][i])
			if(!visited[i])
				ret = max(ret, dfs(i));

	return ret+1;
}

int main(){
	for(int i=0; i<55; i++)
		for(int j=0; j<55; j++)
			graph[i][j] = false;
	for(int i=0; i<55; i++)
		visited[i] = false;

	scanf("%d%d",&n,&m);
	int a,b;
	for(int i=0; i<m; i++){
		scanf("%d%d",&a,&b);
		graph[a][b] = graph[b][a] = true;
	}

	int reacted = 0;
	for(int i=1; i<=n; i++)
		if(!visited[i])
			reacted += dfs(i)-1;

	long long ans = 1;
	for(int i=0; i<reacted; i++)
		ans = ans*2;

	cout << ans << endl;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;

int n,m;

bool graph[55][55];

bool visited[55];

int dfs(int st){
	visited[st] = true;
	int ret = 0;
	for(int i=1; i<=n; i++)
		if(graph[st][i])
			if(!visited[i])
				ret = max(ret, dfs(i));

	return ret+1;
}

int main(){
	scanf("%d%d",&n,&m);
	int a,b;
	for(int i=0; i<m; i++){
		scanf("%d%d",&a,&b);
		graph[a][b] = graph[b][a] = true;
	}

	int reacted = 0;
	for(int i=1; i<=n; i++)
		if(!visited[i])
			reacted += dfs(i)-1;

	long long ans = (1L) << reacted;

	cout << ans;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
#define lli long long int
map<int,lli>arr,sums;
lli dp[5001][5001];
lli go(int i,int j){
    if(i==k||j>n) return 0;
    lli &ans=dp[i][j];
    if(ans) return ans;
    ans=max(ans,go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    ans=max(ans,go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return ans;
}
int main(){
     cin>>n>>m>>k;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1];
     cout<<go(0,1);
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int arr[5001],sums[5001];
int dp[5001][5001];
int go(int i,int j){
    if(i==k||j>n) return 0;
    if(dp[i][j]) return dp[i][j];;
    if(arr[j+m-1]>arr[j]||m-1==0)
    dp[i][j]=max(dp[i][j],go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    dp[i][j]=max(dp[i][j],go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return dp[i][j];
}
int main(){
     cin>>n>>m>>k;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1];
     cout<<go(0,1);
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int arr[5001],sums[5001];
int dp[5001][5001];
int go(int i,int j){
    if(i==k||j>n) return 0;
    if(dp[i][j]) return dp[i][j];
    if(arr[j+m-1]>arr[j]||m-1==0)
    dp[i][j]=max(dp[i][j],go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    dp[i][j]=max(dp[i][j],go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return dp[i][j];
}
int main(){
     cin>>n>>m>>k;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1];
     cout<<go(0,1);
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
long int arr[5005],sums[5005];
long int dp[5005][5005];
int go(int i,int j){
    if(i==k||j>n) return 0;
    if(dp[i][j]) return dp[i][j];
    dp[i][j]=max(dp[i][j],go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    dp[i][j]=max(dp[i][j],go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return dp[i][j];
}
int main(){
     cin>>n>>m>>k;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1];
     cout<<go(0,1);
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int arr[5001],sums[5001];
int dp[5001][5001];
int go(int i,int j){
    if(i==k||j>n) return 0;
    if(dp[i][j]) return dp[i][j];
    dp[i][j]=max(dp[i][j],go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    dp[i][j]=max(dp[i][j],go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return dp[i][j];
}
int main(){
     cin>>n>>m>>k;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1];
     cout<<go(0,1);
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
#define lli long long int
map<int,lli>arr,sums;
lli dp[5001][5001];
lli go(int i,int j){
    if(i==k||j>n) return 0;
    lli &ans=dp[i][j];
    if(ans) return ans;
    ans=max(ans,go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    ans=max(ans,go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return ans;
}
int main(){
     cin>>n>>m>>k;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1];
     if(m==1&&n==k)
     cout<<sums[n];
     else
     cout<<go(0,1);
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
#define lli long long int
map<int,lli>arr,sums;
lli dp[5001][5001];
lli go(int i,int j){
    if(i==k||j>n) return 0;
    lli &ans=dp[i][j];
    if(ans) return ans;
    ans=max(ans,go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    if(m!=1)
    ans=max(ans,go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return ans;
}
int main(){
     cin>>n>>m>>k;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1];
     cout<<go(0,1);
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
#define lli long long int
map<int,lli>arr,sums;
lli dp[5001][5001];
lli go(int i,int j){
    if(i==k||j>n) return 0;
    lli &ans=dp[i][j];
    if(ans) return ans;
    ans=max(ans,go(i+1,j+m)+sums[j+m-1]-sums[j-1]);
    ans=max(ans,go(i,j+1));
    //cout<<dp[i][j]<<" ";
    return ans;
}
int main(){
     cin>>n>>m>>k;
    set<int>s;
     for(int i=1;i<=n;i++) cin>>arr[i],sums[i]=arr[i]+sums[i-1],s.insert(arr[i]);
     if(m==1&&n==k)
     cout<<sums[n];
    else if(s.size()==1&&m==1) cout<<arr[1]*k;
     else
     cout<<go(0,1);
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double
#define pb push_back
#define endl '\n'
#define ff first
#define mp make_pair
#define ss second
#define YES cout << "YES"<<endl;
#define NO cout << "NO"<<endl;
using namespace std;
ll maxn = -1e18;
ll minn = 1e18;
ll mod = 1000000007;
const int maxx = 5005;
ll dp[maxx];
ll a[maxx];
ll ans[maxx][maxx];
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            //freopen("lineup.in","r",stdin);
            //freopen("lineup.out","w",stdout);
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++){
                    cin >> a[i];
            }
            int cur = 0;
            for (int i = 1; i <= m; i++){
                    cur = cur + a[i];
            }
            dp[1] = cur;
            for (int i = 2; i + m - 1 <= n; i++){
                    dp[i] = dp[i - 1] + a[i + m - 1] - a[i - 1];
                    //cout << dp[i] << " ";
            }
            //cout << endl;
            for (int i = 1; i + m - 1 <= n; i++){
                    for (int j = 1; j <= k; j++){
                            if(i - m < 1) ans[i][j] = max(ans[i - 1][j - 1],dp[i]);
                            else ans[i][j] = max(ans[i - 1][j], dp[i] + ans[i - m][j - 1]);
                    }
            }
            //for (int i = 1; i <= k; i++){
            //        cout << ans[1][i] << " ";
            //}
            //cout << endl;
            cout << ans[n - m + 1][k];
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double
#define pb push_back
#define endl '\n'
#define ff first
#define mp make_pair
#define ss second
#define YES cout << "YES"<<endl;
#define NO cout << "NO"<<endl;
using namespace std;
ll maxn = -1e18;
ll minn = 1e18;
ll mod = 1000000007;
const int maxx = 5005;
ll dp[maxx];
ll a[maxx];
ll ans[maxx][maxx];
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            //freopen("lineup.in","r",stdin);
            //freopen("lineup.out","w",stdout);
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++){
                    cin >> a[i];
            }
            ll cur = 0;
            for (int i = 1; i <= m; i++){
                    cur = cur + a[i];
            }
            dp[1] = cur;
            //cout << dp[1] << " " ;
            for (int i = 2; i + m - 1<= n; i++){
                    dp[i] = dp[i - 1] + a[i + m - 1] - a[i - 1];
                    //cout << dp[i] << " ";
            }
            for (int i = 1; i + m - 1 <= n; i++){
                    for (int j = 1; j <= k; j++){
                            if(i - m < 1) ans[i][j] = max(ans[i - 1][j], dp[i]);
                            else ans[i][j] = max(ans[i - 1][j], dp[i] + ans[i - m][j - 1]);
                            ans[i][j] = max(ans[i][j], ans[i][j - 1]);
                    }
                    //cout << endl;
            }
            cout << ans[n - m + 1][k];
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double
#define pb push_back
#define endl '\n'
#define ff first
#define mp make_pair
#define ss second
#define YES cout << "YES"<<endl;
#define NO cout << "NO"<<endl;
using namespace std;
ll maxn = -1e18;
ll minn = 1e18;
ll mod = 1000000007;
const int maxx = 5005;
ll dp[maxx];
ll a[maxx];
ll ans[maxx][maxx];
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            //freopen("lineup.in","r",stdin);
            //freopen("lineup.out","w",stdout);
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++){
                    cin >> a[i];
            }
            int cur = 0;
            for (int i = 1; i <= m; i++){
                    cur = cur + a[i];
            }
            dp[1] = cur;
            //cout << dp[1] << " " ;
            for (int i = 2; i + m - 1<= n; i++){
                    dp[i] = dp[i - 1] + a[i + m - 1] - a[i - 1];
                    //cout << dp[i] << " ";
            }
            for (int i = 1; i + m - 1<= n; i++){
                    for (int j = 1; j <= k; j++){
                            if(i - m < 1) ans[i][j] = max(ans[i - 1][j], dp[i]);
                            else ans[i][j] = max(ans[i - 1][j], dp[i] + ans[i - m][j - 1]);
                            cout << ans[i][j] <<" ";
                    }
                    cout << endl;
            }
            cout << ans[n - m + 1][k];
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double
#define pb push_back
#define endl '\n'
#define ff first
#define mp make_pair
#define ss second
#define YES cout << "YES"<<endl;
#define NO cout << "NO"<<endl;
using namespace std;
ll maxn = -1e18;
ll minn = 1e18;
ll mod = 1000000007;
const int maxx = 5005;
ll dp[maxx];
ll a[maxx];
ll ans[maxx][maxx];
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            //freopen("lineup.in","r",stdin);
            //freopen("lineup.out","w",stdout);
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++){
                    cin >> a[i];
            }
            int cur = 0;
            for (int i = 1; i <= m; i++){
                    cur = cur + a[i];
            }
            dp[1] = cur;
            for (int i = 2; i + m - 1 <= n; i++){
                    dp[i] = dp[i - 1] + a[i + m - 1] - a[i - 1];
            }
            for (int i = 1; i + m - 1 <= n; i++){
                    for (int j = 1; j <= k; j++){
                            if(i - m < 1) ans[i][j] = max(ans[i - 1][j],dp[i]);
                            else ans[i][j] = max(ans[i - 1][j], dp[i] + ans[i - m][j - 1]);
                            //cout << ans[i][j] << " ";
                    }
                    //cout << endl;
            }
            cout << ans[n - m + 1][k];
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double
#define pb push_back
#define endl '\n'
#define ff first
#define mp make_pair
#define ss second
#define YES cout << "YES"<<endl;
#define NO cout << "NO"<<endl;
using namespace std;
ll maxn = -1e18;
ll minn = 1e18;
ll mod = 1000000007;
const int maxx = 5005;
ll dp[maxx];
ll a[maxx];
ll ans[maxx][maxx];
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            //freopen("lineup.in","r",stdin);
            //freopen("lineup.out","w",stdout);
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++){
                    cin >> a[i];
            }
            int cur = 0;
            for (int i = 1; i <= m; i++){
                    cur = cur + a[i];
            }
            dp[1] = cur;
            //cout << dp[1] << " " ;
            for (int i = 2; i + m - 1<= n; i++){
                    dp[i] = dp[i - 1] + a[i + m - 1] - a[i - 1];
                    //cout << dp[i] << " ";
            }
            for (int i = 1; i + m - 1<= n; i++){
                    for (int j = 1; j <= k; j++){
                            if(i - m < 1) ans[i][j] = max(ans[i - 1][j], dp[i]);
                            else ans[i][j] = max(ans[i - 1][j], dp[i] + ans[i - m][j - 1]);
                            //cout << ans[i][j] <<" ";
                    }
                    //cout << endl;
            }
            cout << ans[n - m + 1][k];
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double
#define pb push_back
#define endl '\n'
#define ff first
#define mp make_pair
#define ss second
#define YES cout << "YES"<<endl;
#define NO cout << "NO"<<endl;
using namespace std;
ll maxn = -1e18;
ll minn = 1e18;
ll mod = 1000000007;
const int maxx = 5005;
ll dp[maxx];
ll a[maxx];
ll ans[maxx][maxx];
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            //freopen("lineup.in","r",stdin);
            //freopen("lineup.out","w",stdout);
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++){
                    cin >> a[i];
            }
            int cur = 0;
            for (int i = 1; i <= m; i++){
                    cur = cur + a[i];
            }
            dp[1] = cur;
            //cout << dp[1] << " " ;
            for (int i = 2; i + m - 1<= n; i++){
                    dp[i] = dp[i - 1] + a[i + m - 1] - a[i - 1];
                    //cout << dp[i] << " ";
            }
            for (int i = 1; i + m - 1 <= n; i++){
                    for (int j = 1; j <= k; j++){
                            if(i - m < 1) ans[i][j] = max(ans[i - 1][j], dp[i]);
                            else ans[i][j] = max(ans[i - 1][j], dp[i] + ans[i - m][j - 1]);
                            ans[i][j] = max(ans[i][j], ans[i][j - 1]);
                    }
                    //cout << endl;
            }
            cout << ans[n - m + 1][k];
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double
#define pb push_back
#define endl '\n'
#define ff first
#define mp make_pair
#define ss second
#define YES cout << "YES"<<endl;
#define NO cout << "NO"<<endl;
using namespace std;
ll maxn = -1e18;
ll minn = 1e18;
ll mod = 1000000007;
const int maxx = 5005;
ll dp[maxx];
ll a[maxx];
ll ans[maxx][maxx];
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            //freopen("lineup.in","r",stdin);
            //freopen("lineup.out","w",stdout);
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++){
                    cin >> a[i];
            }
            int cur = 0;
            for (int i = 1; i <= m; i++){
                    cur = cur + a[i];
            }
            dp[1] = cur;
            //cout << dp[1] << " " ;
            for (int i = 2; i + m - 1<= n; i++){
                    dp[i] = dp[i - 1] + a[i + m - 1] - a[i - 1];
                    //cout << dp[i] << " ";
            }
            for (int i = 1; i + m - 1 <= n; i++){
                    for (int j = 1; j <= k; j++){
                            if(i - m <= 1) ans[i][j] = max(ans[i - 1][j], dp[i]);
                            else ans[i][j] = max(ans[i - 1][j], dp[i] + ans[i - m][j - 1]);
                    }
            }
            cout << ans[n - m + 1][k];
}


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

unsigned long long int n,m,k,arr[5001]={0},dp[5001][5001]={0};

unsigned long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

   if(dp[l][cnt]!=-1)
   return dp[l][cnt];

  unsigned long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=0;
   for(j=i;j<=i+m-1;j++)
   sum=sum+arr[j];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    memset(dp,-1,sizeof dp);

    unsigned long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=0;
       for(j=i;j<=i+m-1;j++)
       sum=sum+arr[j];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

 long long int n,m,k,arr[5001]={0},dp[5001][5001]={0},p[5005]={0};

 long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

    if(dp[l][cnt]!=-1)
    return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=p[i+m-1]-p[i-1];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

     long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=p[i+m-1]-p[i-1];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

long long int n,m,k,arr[100001]={0};

long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

  long long int i,j,ans=0,sum=0;
  for(i=l;i<=n;i++)
  {
   sum=0;
   for(j=i;j<=i+m-1;j++)
   sum=sum+arr[j];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

  //  memset(dp,-1,sizeof dp);

    long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i<=n;i++)
    {
       sum=0;
       for(j=i;j<=i+m-1;j++)
       sum=sum+arr[j];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

long long int n,m,k,arr[100001]={0};

long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

  long long int i,j,ans=0,sum=0;
  for(i=l;i<=n;i++)
  {
   sum=0;
   for(j=i;j<=i+m-1;j++)
   sum=sum+arr[j];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

  //  memset(dp,-1,sizeof dp);

    long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i<=n;i++)
    {
       sum=0;
       for(j=i;j<=i+m-1;j++)
       sum=sum+arr[j];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    if(m==1)
    cout<<ans/2;
    else
    cout<<ans;

    return 0;
}


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

long long int n,m,k,arr[5001]={0},dp[5001][5001];

long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

   if(dp[l][cnt]!=-1)
   return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=0;
   for(j=i;j<=i+m-1;j++)
   sum=sum+arr[j];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    memset(dp,-1,sizeof dp);

    long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=0;
       for(j=i;j<=i+m-1;j++)
       sum=sum+arr[j];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

long long int n,m,k,arr[10001]={0},dp[6001][6001];

long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

   if(dp[l][cnt]!=-1)
   return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i<=n;i++)
  {
   sum=0;
   for(j=i;j<=i+m-1;j++)
   sum=sum+arr[j];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    memset(dp,-1,sizeof dp);

    long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i<=n;i++)
    {
       sum=0;
       for(j=i;j<=i+m-1;j++)
       sum=sum+arr[j];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

 long long int n,m,k,arr[5005]={0},dp[5005][6005]={0},p[5005]={0};

 long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

    if(dp[l][cnt]!=-1)
    return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=p[i+m-1]-p[i-1];
   if(dp[i+m][cnt+1]!=-1)
   ans=max(ans,sum+dp[i+m][cnt+1]);
   else
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

     long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=p[i+m-1]-p[i-1];
        if(dp[i+m][cnt+1]!=-1)
       ans=max(ans,sum+dp[i+m][cnt+1]);
       else
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

 long long int n,m,k,arr[5005]={0},dp[5005][7005]={0},p[5005]={0};

 long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

    if(dp[l][cnt]!=-1)
    return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=p[i+m-1]-p[i-1];
   if(dp[i+m][cnt+1]!=-1)
   ans=max(ans,sum+dp[i+m][cnt+1]);
   else
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

     long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=p[i+m-1]-p[i-1];
        if(dp[i+m][cnt+1]!=-1)
       ans=max(ans,sum+dp[i+m][cnt+1]);
       else
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

 long long int n,m,k,arr[5005]={0},dp[5005][5005]={0},p[5005]={0};

 long long int fun(int i,long int cnt)
{
  if(i>n || cnt>=k)
  return 0;

  if(dp[i][cnt]!=-1)
  return dp[i][cnt];

  long long int ans=0;
  ans=max(fun(i+1,cnt),(p[i+m-1]-p[i-1])+fun(i+m,cnt+1));

  dp[i][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

    cout<<max(fun(1,0),p[m]-p[0]+fun(m+1,1));

    return 0;
}


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

 long long int n,m,k,arr[5005]={0},dp[5005][6005]={0},p[5005]={0};

 long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

    if(dp[l][cnt]!=-1)
    return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=p[i+m-1]-p[i-1];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

     long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=p[i+m-1]-p[i-1];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

 long long int n,m,k,arr[5005]={0},dp[5005][10005]={0},p[5005]={0};

 long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

    if(dp[l][cnt]!=-1)
    return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=p[i+m-1]-p[i-1];
   if(dp[i+m][cnt+1]!=-1)
   ans=max(ans,sum+dp[i+m][cnt+1]);
   else
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

     long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=p[i+m-1]-p[i-1];
        if(dp[i+m][cnt+1]!=-1)
       ans=max(ans,sum+dp[i+m][cnt+1]);
       else
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

long  int n,m,k,arr[100001]={0};

long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

  long  int ans=0;
  for(int i=l;i<=n;i++)
  {
   if(cnt<k)
   ans=max(ans,arr[i]+arr[i+m-1]+fun(i+m,cnt+1));
  }

  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

  //  memset(dp,-1,sizeof dp);

    long int i,cnt=0,ans=0;
    for(i=1;i<=n;i++)
    {
      ans=max(ans,arr[i]+arr[i+m-1]+fun(i+m,cnt+1));
    }

    if(m==1)
    cout<<ans/2;
    else
    cout<<ans;

    return 0;
}


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

 long long int n,m,k,arr[5005]={0},dp[5005][5005]={0},p[5005]={0};

 long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

    if(dp[l][cnt]!=-1)
    return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=p[i+m-1]-p[i-1];
   if(dp[i+m][cnt+1]!=-1)
   ans=max(ans,sum+dp[i+m][cnt+1]);
   else
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

     long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=p[i+m-1]-p[i-1];
        if(dp[i+m][cnt+1]!=-1)
       ans=max(ans,sum+dp[i+m][cnt+1]);
       else
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

long long int n,m,k,arr[5001]={0},dp[5001][5001];

long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

   if(dp[l][cnt]!=-1)
   return dp[l][cnt];

  long long int i,j,ans=0,sum=0;
  for(i=l;i<=n;i++)
  {
   sum=0;
   for(j=i;j<=i+m-1;j++)
   sum=sum+arr[j];
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l][cnt]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    memset(dp,-1,sizeof dp);

    long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i<=n;i++)
    {
       sum=0;
       for(j=i;j<=i+m-1;j++)
       sum=sum+arr[j];
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


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

 long long int n,m,k,arr[5005]={0},dp[5005]={0},p[5005]={0};

 long long int fun(int l,long int cnt)
{
   if(l>n || cnt>=k)
   return 0;

    if(dp[l]!=-1)
    return dp[l];

  long long int i,j,ans=0,sum=0;
  for(i=l;i+m-1<=n;i++)
  {
   sum=p[i+m-1]-p[i-1];
   if(dp[i+m]!=-1)
   ans=max(ans,sum+dp[i+m]);
   else
   ans=max(ans,sum+fun(i+m,cnt+1));
  }

  dp[l]=ans;
  return ans;
}

int main() {

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

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++)
    cin>>arr[i];

    for(int i=1;i<=n;i++)
    p[i]=arr[i]+p[i-1];

    memset(dp,-1,sizeof dp);

     long long int i,j,cnt=0,ans=0,sum=0;
    for(i=1;i+m-1<=n;i++)
    {
       sum=p[i+m-1]-p[i-1];
        if(dp[i+m]!=-1)
       ans=max(ans,sum+dp[i+m]);
       else
       ans=max(ans,sum+fun(i+m,cnt+1));
    }

    cout<<ans;

    return 0;
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha
int n, m, k;
int arr[5001];

int dp[5001][2501];

int util(int last_index, int count){
	if(count==0) return 0;
	if(n-last_index < count*m) return 0;

	if(dp[last_index][count]!=-1) return dp[last_index][count];

	int ans = 0;
	loop(i, last_index+m-1, n){
		if(i==m-1) ans = max(ans, util(i+1, count-1) + arr[i]);
		else ans = max(ans, util(i+1, count-1) + (arr[i]-arr[i-m]) );
	}

	return dp[last_index][count] = ans;

}

void alpha()
{
	cin>>n>>m>>k;

	memset(dp, -1, sizeof(dp));

	loop(i,0,n) cin>>arr[i];
	loop(i,1,n) arr[i]+=arr[i-1];

	cout<<util(0,k)<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha
int n, m, k;
int arr[5001];

int dp[5001][5001];

int util(int last_index, int count){
	if(count==k) return 0;
	if(n-last_index < count*m) return 0;

	if(dp[last_index][count]!=-1) return dp[last_index][count];

	int ans = 0;

	// loop(i, last_index+m-1, n){
	// 	if(i==m-1) ans = max(ans, util(i+1, count+1) + arr[i]);
	// 	else ans = max(ans, util(i+1, count+1) + (arr[i]-arr[i-m]) );
	// }

	ans = max(util(last_index+1, count), util(last_index+m, count+1) + arr[last_index+m]-arr[last_index]);

	return dp[last_index][count] = ans;

}

void alpha()
{
	cin>>n>>m>>k;

	memset(dp, -1, sizeof(dp));

	loop(i,0,n) cin>>arr[i];
	loop(i,1,n) arr[i]+=arr[i-1];

	cout<<util(0,0)<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

void alpha()
{
	int n, m, k;
	cin>>n>>m>>k;

	int arr[n];
	loop(i,0,n) cin>>arr[i];

	loop(i,1,n){
		arr[i] += arr[i-1];
	}

	// for(auto  i: arr) cout<<i<<" ";
	// cout<<endl;

	map<int, int> mp;
	int greatest_index;

	int sum = 0;
	while(k--){
		int greatest = 0;
		loop(i,m-1,n){
			if(mp[i]==0){

				if(i==m-1){
					if(greatest < arr[i]) {
						greatest = arr[i];
						greatest_index = i;
					}
				}
				else{
					if(greatest < arr[i]-arr[i-m]) {
						greatest = arr[i]-arr[i-m];
						greatest_index = i;
					}
				}

			}
		}
		sum+=greatest;
		mp[greatest_index]=1;
		// bug(greatest, greatest_index);
	}

	cout<<sum<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

void alpha()
{
	int n, m, k;
	cin>>n>>m>>k;

	int arr[n];
	loop(i,0,n) cin>>arr[i];

	sort(arr, arr+n, greater<int>());

	int sum = 0;

	int i=0, j=0;
	while(k--){
		while(j-i+1<=m){
			sum+=arr[j];
			j++;
		}
		i = j;
	}

	cout<<sum<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha
int n, m, k;
int arr[5001];

int dp[5001][5001];

int util(int last_index, int count){
	if(count==0) return 0;
	if(n-last_index < count*m) return 0;

	if(dp[last_index][count]!=-1) return dp[last_index][count];

	int ans = 0;
	loop(i, last_index+m-1, n-(count-1)*m){
		if(i==m-1) ans = max(ans, util(i+1, count-1) + arr[i]);
		else ans = max(ans, util(i+1, count-1) + (arr[i]-arr[i-m]) );
	}

	return dp[last_index][count] = ans;

}

void alpha()
{
	cin>>n>>m>>k;

	memset(dp, -1, sizeof(dp));

	loop(i,0,n) cin>>arr[i];
	loop(i,1,n) arr[i]+=arr[i-1];

	cout<<util(0,k)<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha
int n, m, k;
int arr[5001];

int dp[5001][5001];

int util(int last_index, int count){
	if(count==k) return 0;
	if(last_index >= n) return 0;

	if(dp[last_index][count]!=-1) return dp[last_index][count];

	int ans = max(util(last_index+m, count+1) + arr[last_index]-(last_index==m-1?0:arr[last_index-m]), util(last_index+1, count));

	return dp[last_index][count] = ans;

}

void alpha()
{
	cin>>n>>m>>k;

	memset(dp, -1, sizeof(dp));

	loop(i,0,n) cin>>arr[i];
	loop(i,1,n) arr[i]+=arr[i-1];

	cout<<util(m-1,0)<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha
int n, m, k;
int arr[5001];

int dp[5001][5001];

int util(int last_index, int count){
	if(count==0) return 0;
	if(n-last_index < count*m) return 0;

	if(dp[last_index][count]!=-1) return dp[last_index][count];

	int ans = 0;
	loop(i, last_index+m-1, n-(count-1)*m){
		if(i==m-1) ans = max(ans, util(i+1, count-1) + arr[i]);
		else ans = max(ans, util(i+1, count-1) + (arr[i]-arr[i-m]) );
	}

	return dp[last_index][count] = ans;

}

void alpha()
{
	cin>>n>>m>>k;

	memset(dp, -1, sizeof(dp));

	loop(i,0,n) cin>>arr[i];
	loop(i,1,n) arr[i]+=arr[i-1];

	loop(i,0,n) {
		if(arr[i]!=0){
			cout<<util(0,k)<<endl;
			return;
		}
	}

	cout<<0<<endl;

}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// while( !(succeed == try()) );

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

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha

#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha
int n, m, k;
int arr[5001];

int dp[5001][5001];

int util(int last_index, int count){
	if(count==0) return 0;
	if(n-last_index < count*m) return 0;

	if(dp[last_index][count]!=-1) return dp[last_index][count];

	int ans = 0;
	loop(i, last_index+m-1, n){
		if(i==m-1) ans = max(ans, util(i+1, count-1) + arr[i]);
		else ans = max(ans, util(i+1, count-1) + (arr[i]-arr[i-m]) );
	}

	return dp[last_index][count] = ans;

}

void alpha()
{
	cin>>n>>m>>k;

	memset(dp, -1, sizeof(dp));

	loop(i,0,n) cin>>arr[i];
	loop(i,1,n) arr[i]+=arr[i-1];

	cout<<util(0,k)<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <map>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f
#define PI 3.1415926535898
#define F first
#define S second
#define endl '\n'
#define lson  rt << 1
#define rson  rt << 1 | 1
#define f(x, y, z) for (int LL x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;

const int maxn = 5e3 + 7;
const int maxm = 1e9 + 7;
const int mod = 1e9 + 7;
int n, m, k;
LL a[maxn], sum[maxn];
LL dp[maxn][maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	_rep(i, 1, n)
	{
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	LL mx = 0;
	_rep(i, m, n)
	{
		LL tmp = sum[i] - sum[i - m];
		int tp = max(0, i - m);
		_rep(j, 1, k)
		{
			_rep(k, 0, tp)
			{
				dp[i][j] = max(dp[i][j], max(dp[k][j], dp[k][j - 1] + tmp));
				mx = max(dp[i][j], mx);
			}
		}
	}
	cout << mx << endl;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <map>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f
#define PI 3.1415926535898
#define F first
#define S second
#define endl '\n'
#define lson  rt << 1
#define rson  rt << 1 | 1
#define f(x, y, z) for (int LL x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;

const int maxn = 5e3 + 7;
const int maxm = 1e9 + 7;
const int mod = 1e9 + 7;
int n, m, k;
LL a[maxn], sum[maxn];
LL dp[maxn][maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	_rep(i, 1, n)
	{
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	LL mx = 0;
	_rep(i, 1, n)
	{
		LL tmp = sum[i] - sum[i - m];
		int tp = max(0, i - m);
		_rep(j, 1, min(i - 1, k))
		{
			dp[i][j] = max(dp[tp][j], dp[tp][j - 1] + tmp);
			mx = max(dp[i][j], mx);
		}
	}
	cout << mx << endl;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <map>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f
#define PI 3.1415926535898
#define F first
#define S second
#define endl '\n'
#define lson  rt << 1
#define rson  rt << 1 | 1
#define f(x, y, z) for (int LL x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;

const int maxn = 5e3 + 7;
const int maxm = 1e9 + 7;
const int mod = 1e9 + 7;
int n, m, k;
LL a[maxn], sum[maxn];
LL dp[maxn][maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	_rep(i, 1, n)
	{
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	LL mx = 0;
	_rep(i, 1, n)
	{
		LL tmp = sum[i] - sum[i - m];
		int tp = max(0, i - m);
		_rep(j, 0, min(i - 1, k))
		{
			dp[i][j] = max(dp[tp][j], dp[tp][j - 1] + tmp);
			mx = max(dp[i][j], mx);
		}
		_rep(j, 1, k) if (dp[i][j] < dp[i - 1][j]) dp[i][j] = dp[i - 1][j];
	}
	cout << mx << endl;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <map>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f
#define PI 3.1415926535898
#define F first
#define S second
#define endl '\n'
#define lson  rt << 1
#define rson  rt << 1 | 1
#define f(x, y, z) for (int LL x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;

const int maxn = 5e3 + 7;
const int maxm = 1e9 + 7;
const int mod = 1e9 + 7;
int n, m, k;
LL a[maxn], sum[maxn];
LL dp[maxn][maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	_rep(i, 1, n)
	{
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	LL mx = 0;
	_rep(i, 1, n)
	{
		LL tmp = sum[i] - sum[i - m];
		int tp = max(0, i - m);
		_rep(j, 1, k)
		{
			dp[i][j] = max(dp[tp][j], dp[tp][j - 1] + tmp);
			mx = max(dp[i][j], mx);
		}
		_rep(j, 1, k) if (dp[i][j] < dp[i - 1][j]) dp[i][j] = dp[i - 1][j];
	}
	cout << mx << endl;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <map>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f
#define PI 3.1415926535898
#define F first
#define S second
#define endl '\n'
#define lson  rt << 1
#define rson  rt << 1 | 1
#define f(x, y, z) for (int LL x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;

const int maxn = 5e3 + 7;
const int maxm = 1e9 + 7;
const int mod = 1e9 + 7;
int n, m, k;
LL a[maxn], sum[maxn];
LL dp[maxn][maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	_rep(i, 1, n)
	{
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	LL mx = 0;
	_rep(i, 1, n)
	{
		LL tmp = sum[i] - sum[i - m];
		int tp = max(0, i - m);
		_rep(j, 1, min(i, k))
		{
			_rep(k, 0, tp)
			{
				dp[i][j] = max(dp[k][j], dp[k][j - 1] + tmp);
				mx = max(dp[i][j], mx);
			}
		}
	}
	cout << mx << endl;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <map>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f
#define PI 3.1415926535898
#define F first
#define S second
#define endl '\n'
#define lson  rt << 1
#define rson  rt << 1 | 1
#define f(x, y, z) for (int LL x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;

const int maxn = 5e3 + 7;
const int maxm = 1e9 + 7;
const int mod = 1e9 + 7;
int n, m, k;
LL a[maxn], sum[maxn];
LL dp[maxn][maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	_rep(i, 1, n)
	{
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	LL mx = 0;
	_rep(i, 1, n)
	{
		LL tmp = sum[i] - sum[i - m];
		int tp = max(0, i - m);
		_rep(j, 1, min(i - 1, k))
		{
			dp[i][j] = max(dp[tp][j], dp[tp][j - 1] + tmp);
			mx = max(dp[i][j], mx);
		}
		_rep(j, 1, k) if (dp[i][j] < dp[i - 1][j]) dp[i][j] = dp[i - 1][j];
	}
	cout << mx << endl;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bitset>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
typedef long long int ll;
#define int unsigned long long
typedef pair <int,int> ii ;
typedef vector < int > vi ;
typedef vector < ii > vii ;
#define rep(i,n)                   for(int i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++)
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define fi first
#define se second
#define all(p)                p.begin(),p.end()
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Endl endl
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (int)r;}
template <class T>inline void sary(T st, T nd){while(st<nd)cin>>*st++;/*sf("%d", st++);*/}
const int mod=1e9+7;
inline ll mul(ll a, ll b){return ((a%mod)*(b%mod))%mod;}
inline ll add(ll a, ll b){return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a, ll b){return ((a%mod)-(b%mod)+mod)%mod;}
const int N= 5e3+1;

int pr[N], dp[N][N];
int n;

int solve(int in, int m, int k) {
  if(dp[in][k]!=-1) return dp[in][k];
  if(k==0) return 0;
  if(in>n) return 0;
  int mx=0;
  mx=solve(in+1,m,k);
  if(in+m-1<=n) mx=max(mx,pr[in+m-1]-pr[in-1]+solve(in+m,m,k-1));
  return dp[in][k]=mx;
}

void calc() {
  int m,k; cin>>n>>m>>k;
  pr[0]=0;
  memset(dp,-1,sizeof dp);
  rep(i,n) {
    int x; cin>>x;
    pr[i+1]=pr[i]+x;
  }
  cout<<solve(1,m,k);
}

int32_t main() {
  IOS
  int t;
  t=1;
  //cin>>t;
  while(t--) calc();
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bitset>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
typedef long long int ll;
#define int long long int
typedef pair <int,int> ii ;
typedef vector < int > vi ;
typedef vector < ii > vii ;
#define rep(i,n)                   for(int i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++)
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define fi first
#define se second
#define all(p)                p.begin(),p.end()
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Endl endl
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (int)r;}
template <class T>inline void sary(T st, T nd){while(st<nd)cin>>*st++;/*sf("%d", st++);*/}
const int mod=1e9+7;
inline ll mul(ll a, ll b){return ((a%mod)*(b%mod))%mod;}
inline ll add(ll a, ll b){return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a, ll b){return ((a%mod)-(b%mod)+mod)%mod;}
const int N= 5e3+1;

int pr[N], dp[N][N];
int n;

int solve(int in, int m, int k) {
  if(k==0) return 0;
  if(in>n) return 0;
  if(dp[in][k]!=-1) return dp[in][k];
  int mx=0;
  mx=solve(in+1,m,k);
  if(in+m-1<=n) mx=max(mx,pr[in+m-1]-pr[in-1]+solve(in+m,m,k-1));
  return dp[in][k]=mx;
}

void calc() {
  int m,k; cin>>n>>m>>k;
  pr[0]=0;
  memset(dp,-1,sizeof dp);
  rep(i,n) {
    int x; cin>>x;
    pr[i+1]=pr[i]+x;
  }
  cout<<solve(1,m,k);
}

int32_t main() {
  IOS
  int t;
  t=1;
  //cin>>t;
  while(t--) calc();
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bitset>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
typedef long long int ll;
#define int long long int
typedef pair <int,int> ii ;
typedef vector < int > vi ;
typedef vector < ii > vii ;
#define rep(i,n)                   for(int i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++)
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define fi first
#define se second
#define all(p)                p.begin(),p.end()
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Endl endl
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (int)r;}
template <class T>inline void sary(T st, T nd){while(st<nd)cin>>*st++;/*sf("%d", st++);*/}
const int mod=1e9+7;
inline ll mul(ll a, ll b){return ((a%mod)*(b%mod))%mod;}
inline ll add(ll a, ll b){return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a, ll b){return ((a%mod)-(b%mod)+mod)%mod;}
const int N= 5e3+1;

int pr[N], dp[N][N];
int n;

int solve(int in, int m, int k) {
  if(k==0) return 0;
  if(in>n) return -1;
  if(dp[in][k]!=-1) return dp[in][k];
  int mx=0;
  repu(i,in,n-m+1) {
    mx=max(mx,pr[i+m-1]-pr[i-1]+solve(i+m,m,k-1));
  }
  return dp[in][k]=mx;
}

void calc() {
  int m,k; cin>>n>>m>>k;
  pr[0]=0;
  memset(dp,-1,sizeof dp);
  rep(i,n) {
    int x; cin>>x;
    pr[i+1]=pr[i]+x;
  }
  cout<<solve(1,m,k);
}

int32_t main() {
  IOS
  int t;
  t=1;
  //cin>>t;
  while(t--) calc();
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bitset>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
typedef long long int ll;
#define int long long int
typedef pair <int,int> ii ;
typedef vector < int > vi ;
typedef vector < ii > vii ;
#define rep(i,n)                   for(int i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++)
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define fi first
#define se second
#define all(p)                p.begin(),p.end()
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Endl endl
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (int)r;}
template <class T>inline void sary(T st, T nd){while(st<nd)cin>>*st++;/*sf("%d", st++);*/}
const int mod=1e9+7;
inline ll mul(ll a, ll b){return ((a%mod)*(b%mod))%mod;}
inline ll add(ll a, ll b){return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a, ll b){return ((a%mod)-(b%mod)+mod)%mod;}
const int N= 5e3+1;

int pr[N], dp[N][N];
int n;

int solve(int in, int m, int k) {
  if(k==0) return 0;
  if(in>n) return -1;
  if(dp[in][k]!=-1) return dp[in][k];
  int mx=0;
  mx=solve(in+1,m,k);
  if(in+m-1<=n) mx=max(mx,pr[in+m-1]-pr[in-1]+solve(in+m,m,k-1));
  return dp[in][k]=mx;
}

void calc() {
  int m,k; cin>>n>>m>>k;
  pr[0]=0;
  memset(dp,-1,sizeof dp);
  rep(i,n) {
    int x; cin>>x;
    pr[i+1]=pr[i]+x;
  }
  cout<<solve(1,m,k);
}

int32_t main() {
  IOS
  int t;
  t=1;
  //cin>>t;
  while(t--) calc();
}


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

#define ull unsigned long long

ull a[5005], n, m, k, dp[5005][5005];

ull call(ull i, ull cnt){

    if(dp[i][cnt]!=-1)
        return dp[i][cnt];

    if(i>(n-m) || cnt>=k)
        return 0;

    ull opt1=0, opt2=0;

    for(ull v=i; v<i+m; v++){
        opt1+=a[v];
    }

    opt1= opt1+call(i+m, cnt+1);

    opt2= call(i+1, cnt);

    return dp[i][cnt]= max(opt1,opt2);

}

main(){
    cin>> n>> m>> k;
    memset(dp, -1, sizeof dp);

    for(ull i=0;i<n;i++)
        cin>>a[i];

    cout<< call(0,0) <<endl;

}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bitset>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
typedef long long int ll;
#define int long long int
typedef pair <int,int> ii ;
typedef vector < int > vi ;
typedef vector < ii > vii ;
#define rep(i,n)                   for(int i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++)
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define fi first
#define se second
#define all(p)                p.begin(),p.end()
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Endl endl
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (int)r;}
template <class T>inline void sary(T st, T nd){while(st<nd)cin>>*st++;/*sf("%d", st++);*/}
const int mod=1e9+7;
inline ll mul(ll a, ll b){return ((a%mod)*(b%mod))%mod;}
inline ll add(ll a, ll b){return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a, ll b){return ((a%mod)-(b%mod)+mod)%mod;}
const int N= 5e3+1;

int pr[N], dp[N][N];
int n;

int solve(int in, int m, int k) {
  if(k==0) return 0;
  if(in>n) return -1;
  if(dp[in][k]!=-1) return dp[in][k];
  int mx=0;
  mx=solve(in+1,m,k);
  if(in+m-1<=n) mx=max(mx,pr[in+m-1]-pr[in-1]+solve(in+m,m,k-1));
  return dp[in][k]=mx;
}

void calc() {
  int m,k; cin>>n>>m>>k;
  memset(dp,-1,sizeof dp);
  pr[0]=0;
  rep(i,n) {
    int x; cin>>x;
    pr[i+1]=pr[i]+x;
  }
  cout<<solve(1,m,k);
}

int32_t main() {
  IOS
  int t;
  t=1;
  //cin>>t;
  while(t--) calc();
}