#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rev(i, n) for(int i = (n) - 1; i >= 0; --i)
#define f(b, x) ((x) - 2 * (b) * (x))
using namespace std;

void bug() { cout << " " << endl; }
template<class T> void bug(T a) { cout << a << "  "; }
template<class T> void bug(T* a, int n) {rep(i, n) bug(a[i]);}

int n, x, a[35][35];

int main() {
    cin >> n;
    rep(i, n) rep(j, n) cin >> a[i][j];
    x = n / 2;
    int ans = -1000000000;
    int b[35];
    rep(mask, (1 << (x + 1))) {
        rep(i, x + 1) b[i] = (mask & (1 << i)) > 0;
        rep(i, x) b[i + x + 1] = b[x] ^ b[i];
        int tmp = -1000000000;
        rep(i, x) {
            rep(b1, 2) rep(b2, 2) {
                if((b1 ^ b2) == b[x]) {
                    int buf = f(b1, a[i][x]) + f(b2, a[i + x + 1][x]);
                    rep(j, x) {
                        int buf2 = -1000000000;
                        rep(c1, 2) rep(c2, 2) rep(c3, 3) rep(c4, 2)
                            if((c1 ^ c4 ^ b[j]) == 0 && (c2 ^ c3 ^ b[j + x + 1]) == 0
                            && (c1 ^ c2 ^ b1) == 0 && (c3 ^ c4 ^ b2) == 0) {
                                buf2 = max(buf2, f(c1, a[i][j]) + f(c2, a[i][j + x + 1])
                                                +f(c3, a[i + x + 1][j + x + 1]) + f(c4, a[i + x + 1][j]));
                            }
                        buf += buf2;
                    }
                    tmp = max(tmp, buf);
                }
            }
        }
        rep(i, n) tmp += f(b[i], a[x][i]);
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rev(i, n) for(int i = (n) - 1; i >= 0; --i)
using namespace std;

void bug() { cout << " " << endl; }
template<class T> void bug(T a) { cout << a << "  "; }
template<class T> void bug(T* a, int n) {rep(i, n) bug(a[i]);}

int n, x, a[35][35];

inline int f(int b, int x) {
    if(!b) return x; else return -x;
}

int main() {
    cin >> n;
    rep(i, n) rep(j, n) cin >> a[i][j];
    x = n / 2;
    int ans = -1000000000;
    int b[35];
    rep(mask, (1 << (x + 1))) {
        rep(i, x + 1) b[i] = (mask & (1 << i)) > 0;
        rep(i, x) b[i + x + 1] = b[x] ^ b[i];
        int res = 0;
        rep(i, x) {
            int tmp = -1000000000;
            rep(b1, 2) rep(b2, 2) {
                if((b1 ^ b2) == b[x]) {
                    int buf = f(b1, a[i][x]) + f(b2, a[i + x + 1][x]);
                    rep(j, x) {
                        int buf2 = -1000000000;
                        rep(c1, 2) rep(c2, 2) rep(c3, 2) rep(c4, 2)
                            if((c1 ^ c4 ^ b[j]) == 0 && (c2 ^ c3 ^ b[j + x + 1]) == 0
                            && (c1 ^ c2 ^ b1) == 0 && (c3 ^ c4 ^ b2) == 0) {
                                buf2 = max(buf2, f(c1, a[i][j]) + f(c2, a[i][j + x + 1])
                                                +f(c3, a[i + x + 1][j + x + 1]) + f(c4, a[i + x + 1][j]));
                            }
                        buf += buf2;
                    }
                    tmp = max(tmp, buf);
                }
            }
            res += tmp;
        }
        rep(i, n) res += f(b[i], a[x][i]);
        ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rev(i, n) for(int i = (n) - 1; i >= 0; --i)
using namespace std;

void bug() { cout << " " << endl; }
template<class T> void bug(T a) { cout << a << "  "; }
template<class T> void bug(T* a, int n) {rep(i, n) bug(a[i]);}

int n, x, a[35][35];

inline int f(int b, int x) {
    if(!b) return x; else return -x;
}

int main() {
    cin >> n;
    rep(i, n) rep(j, n) cin >> a[i][j];
    x = n / 2;
    int ans = -1000000000;
    int b[35];
    rep(mask, (1 << (x + 1))) {
        rep(i, x + 1) b[i] = (mask & (1 << i)) > 0;
        rep(i, x) b[i + x + 1] = b[x] ^ b[i];
        int res = 0;
        rep(i, x) {
            int tmp = -1000000000;
            rep(b1, 2) {
                int b2 = b[x] ^ b1;
                int buf = f(b1, a[i][x]) + f(b2, a[i + x + 1][x]);
                rep(j, x) {
                    int buf2 = -1000000000;
                    rep(c1, 2) {
                        int c4 = b[j] ^ c1;
                        int c2 = b1 ^ c1;
                        int c3 = b2 ^ c4;
                        if((c2 ^ c3) == b[j + x + 1])
                            buf2 = max(buf2, f(c1, a[i][j]) + f(c2, a[i][j + x + 1])
                                            +f(c3, a[i + x + 1][j + x + 1]) + f(c4, a[i + x + 1][j]));
                    }
                    buf += buf2;
                }
                tmp = max(tmp, buf);
            }
            res += tmp;
        }
        rep(i, n) res += f(b[i], a[x][i]);
        ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rev(i, n) for(int i = (n) - 1; i >= 0; --i)
using namespace std;

void bug() { cout << " " << endl; }
template<class T> void bug(T a) { cout << a << "  "; }
template<class T> void bug(T* a, int n) {rep(i, n) bug(a[i]);}

int n, x, a[35][35];

int main() {
    cin >> n;
    rep(i, n) rep(j, n) cin >> a[i][j];
    x = n / 2;
    int ans = -1000000000;
    int b[35];
    rep(mask, (1 << (x + 1))) {
        rep(i, x + 1) b[i] = (mask & (1 << i)) > 0;
        rep(i, x) b[i + x + 1] = b[x] ^ b[i];
        int tmp = 0;
        rep(i, x) rep(j, n) {
            if(b[j] == 1)
                tmp += max(a[i][j] - a[i + x + 1][j],  a[i + x + 1][j] - a[i][j]);
            else
                tmp += max(a[i][j] + a[i + x + 1][j], -a[i + x + 1][j] - a[i][j]);
        }
        rep(j, n) {
            if(b[j] == 0) tmp += a[x][j];
            else tmp += -a[x][j];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int board[33][33];
int ans=-2000000000;
int status[33][33];
int m;
int getvalue(int x,int y)
{
	return (status[x][y]==0?1:-1)*board[x][y];
}
int unit_value(int x,int y,int d)
{
	int uans=0;
	status[x][y]=d;
	uans+=getvalue(x,y);
	status[x][y+m]=status[x][y]^status[x][m];
	uans+=getvalue(x,y+m);
	status[x+m][y]=status[x][y]^status[m][y];
	uans+=getvalue(x+m,y);
	status[x+m][y+m]=status[x+m][y]^status[x+m][m];
	uans+=getvalue(x+m,y+m);
	return uans;
}
int calc_left(int k,int d)
{
	status[m][k]=d;
	status[m][k+m]=d^status[m][m];
	int lans=0;
	lans+=getvalue(m,k)+getvalue(m,m+k);
	for(int i=1;i<m;i++)
		lans+=max(unit_value(i,k,0),unit_value(i,k,1));
	return lans;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			scanf("%d",&board[i][j]);
	m=(n+1)/2;
	for(int s=0;s<(1<<m);s++)
	{
		for(int i=1;i<=m;i++)
			status[i][m]=((s>>(i-1))&1);
		for(int i=1;i<m;i++)
			status[i+m][m]=status[i][m]^status[m][m];
		int tmp_ans=0;
		for(int i=1;i<=n;i++)
			tmp_ans+=getvalue(i,m);
		for(int i=1;i<m;i++)
			tmp_ans+=max(calc_left(i,0),calc_left(i,1));
		ans=max(ans,tmp_ans);
	}
	printf("%d\n",ans);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <ctime>
using namespace std;
const int MAX_N = 33;
int n, k;
int a[MAX_N][MAX_N];
int mul[MAX_N][MAX_N];
int sum[MAX_N][MAX_N];

int doit() {
	for (int r = 0; r + k <= n; ++r) {
		for (int c = 0; c + k <= n; ++c) {
			if (rand() % 2 == 0) {
				mul[r][c] ^= 1;
				mul[r + k][c] ^= 1;
				mul[r][c + k] ^= 1;
				mul[r + k][c + k] ^= 1;
			}
		}
	}

	int cur = 0;
	for (int r = 0; r < n; ++r) {
		for (int c = 0; c < n; ++c) {
			if (r > 0)
				mul[r][c] ^= mul[r - 1][c];
			if (c > 0)
				mul[r][c] ^= mul[r][c - 1];
			if (r > 0 && c > 0)
				mul[r][c] ^= mul[r - 1][c - 1];
			if (mul[r][c] == 1)
				cur += a[r][c] * -1;
			else
				cur += a[r][c];
		}
	}

	for (;;) {
		memset(sum, 0, sizeof sum);
		for (int r = 0; r < n; ++r) {
			for (int c = 0; c < n; ++c) {
				int x = a[r][c];
				if (mul[r][c] == 1)
					x *= -1;
				sum[r + 1][c + 1] = x + sum[r][c + 1] + sum[r + 1][c]
						- sum[r][c];
			}
		}

		int mi = 0, br, bc;
		for (int r = 0; r + k <= n; ++r) {
			for (int c = 0; c + k <= n; ++c) {
				int ret = sum[r + k][c + k] - sum[r][c + k] - sum[r + k][c]
						+ sum[r][c];
				if (ret < mi) {
					mi = ret;
					br = r, bc = c;
				}
			}
		}

		if (mi == 0)
			break;
		cur -= mi;

		//change br,bc
		for (int i = br; i < br + k; ++i) {
			for (int j = bc; j < bc + k; ++j) {
				mul[i][j] ^= 1;
			}
		}
	}

	return cur;
}

int main() {
	cin >> n;
	k = (n + 1) / 2;
	for (int r = 0; r < n; ++r) {
		for (int c = 0; c < n; ++c) {
			cin >> a[r][c];
		}
	}
	int sum = 0;
	for (int r = 0; r < n; ++r) {
		for (int c = 0; c < n; ++c) {
			sum += a[r][c];
		}
	}

	int st = clock();
	int ans = 0;
	while ((clock() - st) / CLOCKS_PER_SEC < 3.0)
		ans = max(ans, doit());
	cout << ans << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
using namespace std;
int n, k;
const int MAX_N = 33;

int a[MAX_N][MAX_N], b[MAX_N][MAX_N];

int main() {
	cin >> n;
	k = n / 2;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cin >> b[i][j];
		}
	}

	int ans = 0;

	for (int msk = 0; msk < (1 << (k + 1)); ++msk) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				a[i][j] = b[i][j];
			}
		}

		for (int i = 0; i <= k; ++i) {
			if (msk >> i & 1) {
				for (int x = k; x <= k + k; ++x) {
					for (int j = i; j <= i + k; ++j) {
						a[x][j] *= -1;
					}
				}
			}
		}

		//i,i+k+1

		int cur = 0;
		for (int i = 0; i < n; ++i) {
			cur += a[k][i];
		}

		for (int i = 0; i < k; ++i) {
			for (int j = 0; j < n; ++j) {
				a[i][j] += a[i + k + 1][j];
			}
		}

		for (int i = 0; i < k; ++i) {
			//i,i+k+1
			int t1 = a[i][k], t2 = -t1;
			for (int j = 0; j < k; ++j) {
				//a[i][j],a[i][j+k+1]
				int x = a[i][j], y = a[i][j + k + 1];
				t1 += max(x + y, -x - y);
				t2 += max(-x + y, x - y);
			}
			cur += max(t1, t2);
		}

		ans = max(ans, cur);
	}

	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define RI register int
const int inf=0x3f3f3f3f;
int n,m,ans;
int a[34][34],t[34][34],bin[20];
#define get(x,y) (t[x][y]?-a[x][y]:a[x][y])
int cal3(int x,int y,int bj) {
    t[x][y]=bj,t[x+m][y]=t[x][y]^t[m][y];
    t[x][y+m]=t[x][y]^t[x][m],t[x+m][y+m]=t[x][y+m]^t[m][y+m];
    int re=get(x,y)+get(x+m,y)+get(x,y+m)+get(x+m,y+m);
    return re;
}
int cal2(int y,int bj) {
    t[m][y]=bj,t[m][y+m]=t[m][y]^t[m][m];
    int re=get(m,y)+get(m,y+m);
    for(RI i=1;i<m;++i) re+=max(cal3(i,y,0),cal3(i,y,1));
    return re;
}
int cal1() {
    int re=0;
    for(RI i=1;i<=n;++i) re+=get(i,m);
    for(RI i=1;i<m;++i) re+=max(cal2(i,0),cal2(i,1));
    return re;
}
int main()
{
    scanf("%d",&n);
    for(RI i=1;i<=n;++i)
        for(RI j=1;j<=n;++j) scanf("%d",&a[i][j]);
    m=(n+1)>>1,ans=-inf;
    bin[1]=1;for(RI i=2;i<=m+1;++i) bin[i]=bin[i-1]<<1;
    for(RI zt=0;zt<bin[m+1];++zt) {
        for(RI i=1;i<=m;++i) t[i][m]=((zt&bin[i])==0?0:1);
        for(RI i=m+1;i<=n;++i) t[i][m]=t[i-m][m]^t[m][m];
        ans=max(ans,cal1());
    }
    printf("%d\n",ans);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<ctime>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
const int N=100005;
int f[1<<18][19],n,m,k,a[19],d[19][19],q,w,e;
int get_sum(int x){
	int cnt=0;
	for(int i=1;i<=20;i++){
		if(x&(1<<i-1)) cnt++;
	}
	return cnt;
}
int main(){
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=k;i++){
		cin>>q>>e>>w;
		d[q][e]=w;
	}
	for(int i=1;i<=(1<<n)-1;i++){
		f[1<<(i-1)][i]=a[i];
	}
	int ans=0;
	for(int s=0;s<=(1<<n)-1;s++){
		if(get_sum(s)>=m) continue;
		for(int j=1;j<=n;j++){// yi zou
			if(!(s&(1<<j-1))) continue;
			for(int i=1;i<=n;i++){//wei zou
				if(s&(1<<i-1)) continue;
			//	cout<<s<<" "<<i<<" "<<j<<" "<<f[s][j]<<" "<<f[s&(1<<i-1)][i]<<endl;
				f[s|(1<<(i-1))][i]=max(f[s|(1<<(i-1))][i],f[s][j]+a[i]+d[j][i]);
				ans=max(ans,f[s|(1<<i-1)][i]);
			}
		}
	}
	//cout<<f[3][2]<<f[2][2];
	cout<<ans<<endl;

	return 0;
}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define hmod 911382323

#define pb push_back

#define sq(x) ((x)*(x))

#define sz(a) ((int)a.size())

#define LEN(a) (a.length())

#define x first

#define y second

#define ls (u<<1)

#define rs (ls + 1)

#define mid (st + ed >> 1)

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define rands(n) (rand()%n+1)

#define rand0(n) (rands(n)-1)

#define Rands(n) ((INT)rand()*rand()%n+1)

#define Rand0(n) (Rands(n)-1)

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

#define rep(i, a, b) for(int i=a; i<b; i++)

#define eprintf(...) fprintf(stderr, __VA_ARGS__)

#define shit(a) (1 << (a))

#define all(a) ((a).begin(), (a).end())

#define rev(a) (power(a, mod-2, mod))

using namespace std;

typedef long long INT;

typedef unsigned long long UINT;

typedef unsigned int uint;

typedef complex<double> Complex;

typedef double DO;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<INT, INT> PII;

typedef pair<pii, int> ppi;

typedef pair<int, pii> pip;

typedef pair<DO, DO> pdd;

typedef pair<int, DO> pid;

typedef pair<DO, int> pdi;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 35

#define MM 18

int a[NN][NN];

int b[NN][NN];

int n;

int m;

int value(int i, int j) {

	if(b[i][j]) return -a[i][j];

	return a[i][j];

}

int cell(int i, int j, int st) {

	b[i][j] = st;

	int x=m;

	b[i][j+x] = b[i][j] ^ b[i][m-1];

	b[i+x][j] = b[i][j] ^ b[m-1][j];

	b[i+x][j+x] = b[i][j+x] ^ b[m-1][j+x];

	return value(i, j) + value(i, j+x) + value(i+x, j) + value(i+x, j+x);

}

int solve(int i, int st) {

	int ans=0;

	b[i][m-1] = st; b[i+m][m-1] = b[i][m-1] ^ b[m-1][m-1];

	for(int j=0; j<m-1; j++) {

		ans+=max(cell(i, j, 0), cell(i, j, 1));

	}

	ans+=value(i, m-1) + value(i+m, m-1);

	return ans;

}

int calc() {

	int ans=0;

	for(int i=0; i<m-1; i++) {

		ans += max(solve(i, 0), solve(i, 1));

	}

	for(int i=0; i<n; i++) ans += value(m-1, i);

	return ans;

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	cin >> n;

	for(int i=0; i<n; i++) {

		for(int j=0; j<n; j++) gn(a[i][j]);

	}

	m=n/2+1;

	int ans=-inf;

	for(int i=0; i<1<<m; i++) {

		for(int j=0; j<m; j++) b[m-1][j] = bit(i, j);

		for(int j=m; j<n; j++) b[m-1][j] = b[m-1][j-m] ^ b[m-1][m-1];

		smax(ans, calc());

	//	cout << calc() << endl;

	}

	cout << ans << endl;

	return 0;

}


#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <cctype>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 50;
int n, x;
int key[N][N], a[N][N];

int getsum(int tx, int ty, int opt) {
	int sum = a[tx][ty] * opt;
	sum += a[tx + x][ty] * (opt * key[x][ty]);
	sum += a[tx][ty + x] * (opt * key[tx][x]);
	sum += a[tx + x][ty + x] * (opt * key[tx][x] * key[x][ty + x]);
	return sum;
}

int query(int dep, int opt) {
	key[x][dep] = opt;
	key[x][dep + x] = opt * key[x][x];

	int sum = 0;
	for (int i = 1; i < x; i++)
		sum += max(getsum(i, dep, 1), getsum(i, dep, -1)) + key[x][i] * a[x][i] + key[x][i + x] * a[x][i + x];

	return sum;
}

int calc() {
	int sum = 0;
	for (int i = 1; i < x; i++)
		sum += max(query(i, -1), query(i, 1));
	return sum;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			scanf("%d", &a[i][j]);
	x = (n + 1) / 2;
	int ans = -1000010000;
	for (int i = 0; i < (1 << x); i++) {
		for (int j = 1, t = i; j <= x; j++, t >>= 1)
			if (t & 1) key[j][x] = 1;
			else key[j][x] = -1;
		int temp = a[x][x] * key[x][x];
		for (int j = 1; j < x; j++)
			temp += key[j][x] * a[j][x] + key[j][x] * key[x][x] * a[j + x][x];
		ans = max(ans, calc() + temp);
	}
	printf("%d\n", ans);

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <cctype>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 50;
int n, x;
int key[N][N], a[N][N], s[N][N];

int getsum(int tx, int ty) {
	int sum = a[tx + x][ty] * key[x][ty];
	sum += a[tx + x][ty + x] * key[tx][x] * key[x][ty + x];
	return sum;
}

int query(int dep, int opt) {
	key[x][dep] = opt;
	key[x][dep + x] = opt * key[x][x];

	int sum = key[x][dep] * a[x][dep] + key[x][x + dep] * a[x][x + dep];
	for (int i = 1; i < x; i++)
		sum += abs(getsum(i, dep) + s[i][dep]);
	return sum;
}

int calc() {
	int sum = 0;
	for (int i = 1; i < x; i++)
		for (int j = 1; j < x; j++)
			s[i][j] = a[i][j] + a[i][j + x] * key[i][x];
	for (int i = 1; i < x; i++)
		sum += max(query(i, -1), query(i, 1));
	return sum;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			scanf("%d", &a[i][j]);
	x = (n + 1) / 2;
	int ans = -1000010000;
	for (int i = 0; i < (1 << x); i++) {
		for (int j = 1, t = i; j <= x; j++, t >>= 1)
			if (t & 1) key[j][x] = 1;
			else key[j][x] = -1;
		int temp = a[x][x] * key[x][x];
		for (int j = 1; j < x; j++)
			temp += key[j][x] * a[j][x] + key[j][x] * key[x][x] * a[j + x][x];
		ans = max(ans, calc() + temp);
	}
	printf("%d\n", ans);

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <cctype>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 50;
int n, x;
int key[N][N], a[N][N];

int getsum(int tx, int ty) {
	int sum = a[tx][ty];
	sum += a[tx + x][ty] * key[x][ty];
	sum += a[tx][ty + x] * key[tx][x];
	sum += a[tx + x][ty + x] * key[tx][x] * key[x][ty + x];
	return sum;
}

int query(int dep, int opt) {
	key[x][dep] = opt;
	key[x][dep + x] = opt * key[x][x];

	int sum = key[x][dep] * a[x][dep] + key[x][x + dep] * a[x][x + dep];
	for (int i = 1; i < x; i++)
		sum += abs(getsum(i, dep));

	//for (int i = 1; i <= n; i++)
		//for (int j = 1; j <= n; j++)
			//printf("%d%c", key[i][j], j == n ? '\n' : ' ');
	//printf("sum: %d\n", sum);

	return sum;
}

int calc() {
	int sum = 0;
	for (int i = 1; i < x; i++)
		sum += max(query(i, -1), query(i, 1));
	return sum;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			scanf("%d", &a[i][j]);
	x = (n + 1) / 2;
	int ans = -1000010000;
	for (int i = 0; i < (1 << x); i++) {
		for (int j = 1, t = i; j <= x; j++, t >>= 1)
			if (t & 1) key[j][x] = 1;
			else key[j][x] = -1;
		int temp = a[x][x] * key[x][x];
		for (int j = 1; j < x; j++)
			temp += key[j][x] * a[j][x] + key[j][x] * key[x][x] * a[j + x][x];
		ans = max(ans, calc() + temp);
	}
	printf("%d\n", ans);

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <cctype>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 50;
int n, x;
int key[N][N], a[N][N], s[N][N];

int getsum(int tx, int ty) {
	int sum = a[tx][ty + x] * key[tx][x];
	sum += a[tx + x][ty + x] * key[tx][x] * key[x][ty + x];
	return sum;
}

int query(int dep, int opt) {
	key[x][dep] = opt;
	key[x][dep + x] = opt * key[x][x];

	int sum = key[x][dep] * a[x][dep] + key[x][x + dep] * a[x][x + dep];
	for (int i = 1; i < x; i++)
		sum += abs(getsum(i, dep) + s[i][dep]);
	return sum;
}

int calc() {
	int sum = 0;
	for (int i = 1; i < x; i++)
		for (int j = 1; j < x; j++)
			s[i][j] = a[i][j] + a[i + x][j] * key[x][j];
	for (int i = 1; i < x; i++)
		sum += max(query(i, -1), query(i, 1));
	return sum;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			scanf("%d", &a[i][j]);
	x = (n + 1) / 2;
	int ans = -1000010000;
	for (int i = 0; i < (1 << x); i++) {
		for (int j = 1, t = i; j <= x; j++, t >>= 1)
			if (t & 1) key[j][x] = 1;
			else key[j][x] = -1;
		int temp = a[x][x] * key[x][x];
		for (int j = 1; j < x; j++)
			temp += key[j][x] * a[j][x] + key[j][x] * key[x][x] * a[j + x][x];
		ans = max(ans, calc() + temp);
	}
	printf("%d\n", ans);

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <cctype>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 50;
int n, x;
int key[N][N], a[N][N];

int getsum(int tx, int ty, int opt) {
	int sum = a[tx][ty] * opt;
	sum += a[tx + x][ty] * (opt * key[x][ty]);
	sum += a[tx][ty + x] * (opt * key[tx][x]);
	sum += a[tx + x][ty + x] * (opt * key[tx][x] * key[x][ty + x]);
	return sum;
}

int query(int dep, int opt) {
	key[x][dep] = opt;
	key[x][dep + x] = opt * key[x][x];

	int sum = key[x][dep] * a[x][dep] + key[x][x + dep] * a[x][x + dep];
	for (int i = 1; i < x; i++)
		sum += max(getsum(i, dep, 1), getsum(i, dep, -1));

	//for (int i = 1; i <= n; i++)
		//for (int j = 1; j <= n; j++)
			//printf("%d%c", key[i][j], j == n ? '\n' : ' ');
	//printf("sum: %d\n", sum);

	return sum;
}

int calc() {
	int sum = 0;
	for (int i = 1; i < x; i++)
		sum += max(query(i, -1), query(i, 1));
	return sum;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			scanf("%d", &a[i][j]);
	x = (n + 1) / 2;
	int ans = -1000010000;
	for (int i = 0; i < (1 << x); i++) {
		for (int j = 1, t = i; j <= x; j++, t >>= 1)
			if (t & 1) key[j][x] = 1;
			else key[j][x] = -1;
		int temp = a[x][x] * key[x][x];
		for (int j = 1; j < x; j++)
			temp += key[j][x] * a[j][x] + key[j][x] * key[x][x] * a[j + x][x];
		ans = max(ans, calc() + temp);
	}
	printf("%d\n", ans);

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<algorithm>

using namespace std;

const int MaxN = 33 + 3;
const int oo = 0x3f3f3f3f;

int N, X;
int a[MaxN][MaxN], b[MaxN][MaxN];

void update(int &a, int b) {
    if (b > a) {
        a = b;
    }
}

int check(int sta) {
    int res = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            a[i][j] = b[i][j];
        }
    }
    for (int j = 0; j < N; ++j) {
        int now;
        if (j <= X) {
            now = ((sta >> j) & 1);
        }
        else {
            now = ((sta >> (j - X - 1)) & 1) ^ ((sta >> X) & 1);
        }
        if (now) {
            res -= a[X][j];
            for (int i = 0; i < X; ++i) {
                a[i][j] -= a[i + X + 1][j];
            }
        }
        else {
            res += a[X][j];
            for (int i = 0; i < X; ++i) {
                a[i][j] += a[i + X + 1][j];
            }
        }
    }
    for (int i = 0; i < X; ++i) {
        int sum1 = -a[i][X], sum2 = +a[i][X];
        for (int j = 0; j < X; ++j) {
            sum1 += abs(a[i][j] - a[i][j + X + 1]);
            sum2 += abs(a[i][j] + a[i][j + X + 1]);
        }
        res += max(sum1, sum2);
    }
    return res;
}

int main() {
    scanf("%d", &N);
    X = N / 2;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            scanf("%d", b[i] + j);
        }
    }
    int ans = -oo;
    for (int sta = 0; sta < (1 << (X + 1)); ++sta) {
        update(ans, check(sta));
    }
    printf("%d\n", ans);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<algorithm>

using namespace std;

const int MaxN = 33 + 3;
const int oo = 0x3f3f3f3f;

int N, X;
int a[MaxN][MaxN], b[MaxN][MaxN];

void update(int &a, int b) {
    if (b > a) {
        a = b;
    }
}

int check(int sta) {
    int res = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            a[i][j] = b[i][j];
        }
    }
    for (int j = 0; j < N; ++j) {
        int now;
        if (j <= X) {
            now = ((sta >> j) & 1);
        }
        else {
            now = ((sta >> (j - X - 1)) & 1) ^ ((sta >> X) & 1);
        }
        if (now) {
            res -= a[X][j];
            for (int i = 0; i < X; ++i) {
                a[i][j] -= a[i + X + 1][j];
            }
        }
        else {
            res += a[X][j];
            for (int i = 0; i < X; ++i) {
                a[i][j] += a[i + X + 1][j];
            }
        }
    }
    for (int i = 0; i < X; ++i) {
        int sum1 = a[i][X], sum2 = -a[i][X];
        for (int j = 0; j < X; ++j) {
            sum1 += abs(a[i][j] - a[i][j + X]);
            sum2 += abs(a[i][j] + a[i][j + X]);
            res += max(sum1, sum2);
        }
    }
    return res;
}

int main() {
    scanf("%d", &N);
    X = N / 2;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            scanf("%d", b[i] + j);
        }
    }
    int ans = -oo;
    for (int sta = 0; sta < (1 << (X + 1)); ++sta) {
        update(ans, check(sta));
    }
    printf("%d\n", ans);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int INF=0x7fffffff/2;
const int SIZEN=50;
int N,M;
int A[SIZEN][SIZEN];
int setup[SIZEN][SIZEN];
int sgn(int a){//0��δ��,1�Ƿ���
	return !a?1:-1;
}
int single_val(int x,int y){
	return sgn(setup[x][y])*A[x][y];
}
int calc_unit(int x,int y,int d){//(x,y)����Ԫ��,Ҫ�����߾��ѷ���setup��
	int ans=0;
	setup[x][y]=d;
	ans+=single_val(x,y);
	setup[x][y+M]=setup[x][y]^setup[x][M];
	ans+=single_val(x,y+M);
	setup[x+M][y]=setup[x][y]^setup[M][y];
	ans+=single_val(x+M,y);
	setup[x+M][y+M]=setup[x+M][y]^setup[x+M][M];
	ans+=single_val(x+M,y+M);
	return ans;
}
int calc_unit(int x,int y){//(x,y)����Ԫ������ֵ
	return max(calc_unit(x,y,0),calc_unit(x,y,1));
}
int calc_left(int k,int d){//�յ��M��k�е�ֵΪd
	setup[M][k]=d;
	setup[M][k+M]=d^setup[M][M];
	int ans=0;
	ans+=single_val(M,k)+single_val(M,k+M);
	for(int i=1;i<M;i++) ans+=calc_unit(i,k);
	//for(int i=1;i<=N;i++){cout<<setup[i][M]<<" ";}cout<<endl;
	return ans;
}
int calc_left(int k){//�����M��k�е���󷽰�
	return max(calc_left(k,0),calc_left(k,1));
}
int calc_all(void){//��M�е�1~M���Ѿ�������,�����ֵ
	for(int i=1;i<M;i++) setup[i+M][M]=setup[i][M]^setup[M][M];
	int ans=0;
	for(int i=1;i<=N;i++) ans+=single_val(i,M);
	for(int i=1;i<M;i++) ans+=calc_left(i);
	//for(int i=1;i<=N;i++){cout<<setup[i][M]<<" ";}cout<<endl<<ans<<endl<<endl;
	return ans;
}
void work(void){
	int ans=-INF;
	for(int s=0;s<(1<<M);s++){
		for(int i=1;i<=M;i++){
			setup[i][M]=((s>>(i-1))&1);
		}
		ans=max(ans,calc_all());
	}
	printf("%d\n",ans);
}
void read(void){
	scanf("%d",&N);
	M=(N+1)/2;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			scanf("%d",&A[i][j]);
		}
	}
}
int main(){
	//freopen("t1.in","r",stdin);
	read();
	//calc_unit(1,1);
	//calc_unit(2,1);
	//calc_unit(2,1,1);
	//cout<<calc_left(1,0)<<endl;
	/*for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){cout<<setup[i][j]<<" ";}cout<<endl;
	}cout<<endl;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){cout<<A[i][j]<<" ";}cout<<endl;
	}cout<<endl;*/
	//cout<<calc_left(2,1)<<endl;
	//cout<<calc_unit(1,2)<<endl;
	/*for(int i=1;i<3;i++){
		for(int j=1;j<3;j++){
			cout<<calc_unit(i,j)<<" ";
		}
		cout<<endl;
	}*/
	//cout<<calc_all()<<endl;
	work();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int INF=0x7fffffff/2;
const int SIZEN=50;
int N,M;
int A[SIZEN][SIZEN];
int setup[SIZEN][SIZEN];
inline int sgn(int a){//0��δ��,1�Ƿ���
	return !a?1:-1;
}
inline int single_val(int x,int y){
	return sgn(setup[x][y])*A[x][y];
}
inline int calc_unit(int x,int y,int d){//(x,y)����Ԫ��,Ҫ�����߾��ѷ���setup��
	int ans=0;
	setup[x][y]=d;
	ans+=single_val(x,y);
	setup[x][y+M]=setup[x][y]^setup[x][M];
	ans+=single_val(x,y+M);
	setup[x+M][y]=setup[x][y]^setup[M][x];
	ans+=single_val(x,y+M);
	setup[x+M][y+M]=setup[x+M][y]^setup[x+M][M];
	ans+=single_val(x+M,y+M);
	return ans;
}
inline int calc_unit(int x,int y){//(x,y)����Ԫ������ֵ
	return max(calc_unit(x,y,0),calc_unit(x,y,1));
}
inline int calc_left(int k,int d){//�յ��M��k�е�ֵΪd
	setup[M][k]=d;
	setup[M][k+M]=d^setup[M][M];
	int ans=0;
	ans+=single_val(M,k)+single_val(M,k+M);
	for(int i=1;i<M;i++) ans+=calc_unit(i,k);
	return ans;
}
inline int calc_left(int k){//�����M��k�е���󷽰�
	return max(calc_left(k,0),calc_left(k,1));
}
int calc_all(void){//��M�е�1~M���Ѿ�������,�����ֵ
	for(int i=1;i<M;i++) setup[i+M][M]=setup[i][M]^setup[M][M];
	int ans=0;
	for(int i=1;i<=N;i++) ans+=single_val(i,M);
	for(int i=1;i<M;i++) ans+=calc_left(i);
	return ans;
}
void work(void){
	int ans=-INF;
	for(int s=0;s<(1<<M);s++){
		for(int i=1;i<=M;i++){
			setup[i][M]=((s>>(i-1))&1);
		}
		ans=max(ans,calc_all());
	}
	printf("%d\n",ans);
}
void read(void){
	scanf("%d",&N);
	M=(N+1)/2;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			scanf("%d",&A[i][j]);
		}
	}
}
int main(){
	read();
	work();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int INF=0x7fffffff/2;
const int SIZEN=50;
int N,M;
int A[SIZEN][SIZEN];
int setup[SIZEN][SIZEN];
inline int sgn(int a){//0��δ��,1�Ƿ���
	return !a?1:-1;
}
inline int single_val(int x,int y){
	return sgn(setup[x][y])*A[x][y];
}
inline int calc_unit(int x,int y,int d){//(x,y)����Ԫ��,Ҫ�����߾��ѷ���setup��
	int ans=0;
	setup[x][y]=d;
	ans+=single_val(x,y);
	setup[x][y+M]=setup[x][y]^setup[x][M];
	ans+=single_val(x,y+M);
	setup[x+M][y]=setup[x][y]^setup[M][x];
	ans+=single_val(x+M,y);
	setup[x+M][y+M]=setup[x+M][y]^setup[x+M][M];
	ans+=single_val(x+M,y+M);
	return ans;
}
inline int calc_unit(int x,int y){//(x,y)����Ԫ������ֵ
	return max(calc_unit(x,y,0),calc_unit(x,y,1));
}
inline int calc_left(int k,int d){//�յ��M��k�е�ֵΪd
	setup[M][k]=d;
	setup[M][k+M]=d^setup[M][M];
	int ans=0;
	ans+=single_val(M,k)+single_val(M,k+M);
	for(int i=1;i<M;i++) ans+=calc_unit(i,k);
	return ans;
}
inline int calc_left(int k){//�����M��k�е���󷽰�
	return max(calc_left(k,0),calc_left(k,1));
}
int calc_all(void){//��M�е�1~M���Ѿ�������,�����ֵ
	for(int i=1;i<M;i++) setup[i+M][M]=setup[i][M]^setup[M][M];
	int ans=0;
	for(int i=1;i<=N;i++) ans+=single_val(i,M);
	for(int i=1;i<M;i++) ans+=calc_left(i);
	return ans;
}
void work(void){
	int ans=-INF;
	for(int s=0;s<(1<<M);s++){
		for(int i=1;i<=M;i++){
			setup[i][M]=((s>>(i-1))&1);
		}
		ans=max(ans,calc_all());
	}
	printf("%d\n",ans);
}
void read(void){
	scanf("%d",&N);
	M=(N+1)/2;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			scanf("%d",&A[i][j]);
		}
	}
}
int main(){
	//freopen("t1.in","r",stdin);
	read();
	work();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int INF=0x7fffffff/2;
const int SIZEN=50;
int N,M;
int A[SIZEN][SIZEN];
int setup[SIZEN][SIZEN];
int sgn(int a){//0��δ��,1�Ƿ���
	return !a?1:-1;
}
int single_val(int x,int y){
	return sgn(setup[x][y])*A[x][y];
}
int calc_unit(int x,int y,int d){//(x,y)����Ԫ��,Ҫ�����߾��ѷ���setup��
	int ans=0;
	setup[x][y]=d;
	ans+=single_val(x,y);
	setup[x][y+M]=setup[x][y]^setup[x][M];
	ans+=single_val(x,y+M);
	setup[x+M][y]=setup[x][y]^setup[M][y];
	ans+=single_val(x+M,y);
	setup[x+M][y+M]=setup[x+M][y]^setup[x+M][M];
	ans+=single_val(x+M,y+M);
	return ans;
}
int calc_unit(int x,int y){//(x,y)����Ԫ������ֵ
	return max(calc_unit(x,y,0),calc_unit(x,y,1));
}
int calc_left(int k,int d){//�յ��M��k�е�ֵΪd
	setup[M][k]=d;
	setup[M][k+M]=d^setup[M][M];
	int ans=0;
	ans+=single_val(M,k)+single_val(M,k+M);
	for(int i=1;i<M;i++) ans+=calc_unit(i,k);
	return ans;
}
int calc_left(int k){//�����M��k�е���󷽰�
	return max(calc_left(k,0),calc_left(k,1));
}
int calc_all(void){//��M�е�1~M���Ѿ�������,�����ֵ
	for(int i=1;i<M;i++) setup[i+M][M]=setup[i][M]^setup[M][M];
	int ans=0;
	for(int i=1;i<=N;i++) ans+=single_val(i,M);
	for(int i=1;i<M;i++) ans+=calc_left(i);
	return ans;
}
void work(void){
	int ans=-INF;
	for(int s=0;s<(1<<M);s++){
		for(int i=1;i<=M;i++){
			setup[i][M]=((s>>(i-1))&1);
		}
		ans=max(ans,calc_all());
	}
	printf("%d\n",ans);
}
void read(void){
	scanf("%d",&N);
	M=(N+1)/2;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			scanf("%d",&A[i][j]);
		}
	}
}
int main(){
	//freopen("t1.in","r",stdin);
	read();
	work();
	return 0;
}


/*
	Time : 0839Z 20141119
	Task : Codeforces 321D
	Tags : Enumeration
	Stat : Coding
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <numeric>

#define fi first
#define se second
#define fo(i,a,b) for (int i = a; i <= b; i ++)
#define fd(i,a,b) for (int i = a; i >= b; i --)
#define fe(i,x,y) for (int i = x, y = lnk[i]; i; i = nxt[i], y = lnk[i])
#define mkp make_pair
#define pb push_back
#define Fill(x,y) memset(x,y,sizeof(x))
#define Cpy(x,y) memcpy(x,y,sizeof(x))
#define Bit(x,y) ((((x) >> (y)) & 1))
#define mit map<int,SI>::iterator
#define sit SI::iterator

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair <double, double> PD;
typedef pair <LL, LL> PLI;
typedef pair <PD, int> PDI;
typedef pair <int, int> PI;
typedef pair <int, PI> PII;
typedef pair <PI, PI> PIII;
typedef set <PI> SI;
typedef vector <int> VI;

int Read()
{
    char c; while (c = getchar(), (c != '-') && (c < '0' || c > '9'));
    bool neg = (c == '-'); int ret = (neg ? 0 : c - 48);
    while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + c - 48;
    return neg ? -ret : ret;
}

int N, M, ans = -1e9, a[35][35], b[35], c[35];

void init()
{
	scanf("%d", &N), M = N / 2 + 1;
	fo (i, 1, N) fo (j, 1, N) a[i][j] = Read();
}

void work()
{
	fo (mask, 0, (1 << M) - 1)
	{
		int cur = 0;
		fd (i, M, 1)
		{
			b[i] = Bit(mask, i - 1) ? -1 : 1, cur += a[i][M] * b[i];
			b[i + M] = b[M] * b[i], cur += a[i + M][M] * b[i + M];
		}
		fo (i, 1, M - 1)
		{
			fo (j, 1, N) c[j] = a[j][i] + b[j] * a[j][i + M];
			int c0 = c[M], c1 = -c[M];
			fo (j, 1, M - 1) c0 += abs(c[j] + c[j + M]), c1 += abs(c[j] - c[j + M]);
			cur += max(c0, c1);
		}
		ans = max(ans, cur);
	}
	printf("%d\n", ans);
}

int main()
{
	init();
	work();
	return 0;
}


//It is coded by ning_mew on 6.26
#include<bits/stdc++.h>
using namespace std;

const int maxn=35;

int n,m,ans=-999999999;
int a[maxn][maxn];
int cho[maxn][maxn];

inline void oprate(){
  for(int i=m+1;i<=n;i++){cho[i][m]=(cho[m][m]^cho[i-m][m]);}
  int ans_box=0,box=0,boxbox=0,box1=0,box2=0;
  for(int i=1;i<=m-1;i++){///y
    //////////////////
    cho[m][i]=1; cho[m][i+m]=(cho[m][i]^cho[m][m]);

    box=0;
    for(int j=1;j<=m-1;j++){///x
      box1=0;box2=0;
      cho[j][i]=1;
      cho[j+m][i]=(cho[j][i]^cho[m][i]);
      cho[j][i+m]=(cho[j][i]^cho[j][m]);
      cho[j+m][i+m]=(cho[j+m][i]^cho[j+m][m]);

      if(cho[j][i])box1-=a[j][i];else box1+=a[j][i];
      if(cho[j+m][i])box1-=a[j+m][i];else box1+=a[j+m][i];
      if(cho[j][i+m])box1-=a[j][i+m];else box1+=a[j][i+m];
      if(cho[j+m][i+m])box1-=a[j+m][i+m];else box1+=a[j+m][i+m];

      cho[j][i]=0;
      cho[j+m][i]=(cho[j][i]^cho[m][i]);
      cho[j][i+m]=(cho[j][i]^cho[j][m]);
      cho[j+m][i+m]=(cho[j+m][i]^cho[j+m][m]);

      if(cho[j][i])box2-=a[j][i];else box2+=a[j][i];
      if(cho[j+m][i])box2-=a[j+m][i];else box2+=a[j+m][i];
      if(cho[j][i+m])box2-=a[j][i+m];else box2+=a[j][i+m];
      if(cho[j+m][i+m])box2-=a[j+m][i+m];else box2+=a[j+m][i+m];

      box+=max(box1,box2);
    }
    if(cho[m][i])box-=a[m][i];else box+=a[m][i];
    if(cho[m][i+m])box-=a[m][i+m];else box+=a[m][i+m];

    //////////////////
    cho[m][i]=0; cho[m][i+m]=(cho[m][i]^cho[m][m]);

    boxbox=0;
    for(int j=1;j<=m-1;j++){///x
      box1=0;box2=0;
      cho[j][i]=1;
      cho[j+m][i]=(cho[j][i]^cho[m][i]);
      cho[j][i+m]=(cho[j][i]^cho[j][m]);
      cho[j+m][i+m]=(cho[j+m][i]^cho[j+m][m]);

      if(cho[j][i])box1-=a[j][i];else box1+=a[j][i];
      if(cho[j+m][i])box1-=a[j+m][i];else box1+=a[j+m][i];
      if(cho[j][i+m])box1-=a[j][i+m];else box1+=a[j][i+m];
      if(cho[j+m][i+m])box1-=a[j+m][i+m];else box1+=a[j+m][i+m];

      cho[j][i]=0;
      cho[j+m][i]=(cho[j][i]^cho[m][i]);
      cho[j][i+m]=(cho[j][i]^cho[j][m]);
      cho[j+m][i+m]=(cho[j+m][i]^cho[j+m][m]);

      if(cho[j][i])box2-=a[j][i];else box2+=a[j][i];
      if(cho[j+m][i])box2-=a[j+m][i];else box2+=a[j+m][i];
      if(cho[j][i+m])box2-=a[j][i+m];else box2+=a[j][i+m];
      if(cho[j+m][i+m])box2-=a[j+m][i+m];else box2+=a[j+m][i+m];
      boxbox+=max(box1,box2);
    }
    if(cho[m][i])boxbox-=a[m][i];else boxbox+=a[m][i];
    if(cho[m][i+m])boxbox-=a[m][i+m];else boxbox+=a[m][i+m];
    ans_box+=max(box,boxbox);
    //////////////////
  }
  //box=(前面处理)+中间一竖条
  for(int i=1;i<=n;i++){
    if(cho[i][m])ans_box-=a[i][m];else ans_box+=a[i][m];
  }
  ans=max(ans,ans_box);return;
}
inline void dfs(){
  for(int i=0;i<=(1<<m)-1;i++){
    for(int j=0;j<m;j++){cho[j+1][m]=((i>>j)&1);}
    oprate();
  }
}
int main(){
  scanf("%d",&n);m=(n+1)/2;
  //memset(cho,-1,sizeof(cho));
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){scanf("%d",&a[i][j]);}
  }dfs();
  printf("%d\n",ans);
  return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<queue>
#include<cstdlib>
#include<vector>
#include<cmath>
#define sqr(x) ((x)*(x))
#define ls (k<<1)
#define rs (k<<1|1)
#define MP(x,y) make_pair(x,y)
#define fir first
#define sc second
using namespace std;
#define N 35
int n,a[N][N],b[N],x;
int main(){
	scanf("%d",&n);x=(n+1)/2;
	for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)scanf("%d",&a[i][j]);int ans=INT_MIN;
	for(int i=0;i<=(1<<x)-1;i++){
		for(int j=1;j<=x;j++)if(i&(1<<(j-1)))b[j]=1;else b[j]=-1;
		int Tmp=0;for(int j=1;j<=x-1;j++){
			int tmp=INT_MIN;for(int k=-1;k<=1;k+=2){
				int X=a[x][j]*k+k*b[x]*a[x][j+x];
				for(int l=1;l<=x-1;l++)X+=max(a[l][j]+k*a[l+x][j]+b[l]*a[l][j+x]+k*b[x]*b[l]*a[l+x][j+x],-a[l][j]+(-k)*a[l+x][j]+(-b[l])*a[l][j+x]+(-k)*b[l]*b[x]*a[l+x][j+x]);
				tmp=max(tmp,X);
			}Tmp+=tmp;
		}for(int j=1;j<=x-1;j++)Tmp+=b[j]*a[j][x]+b[j]*b[x]*a[j+x][x];
		Tmp+=b[x]*a[x][x];
		ans=max(ans,Tmp);
	}printf("%d\n",ans);
}


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

#define N 35
int A[N][N],d[]={1,-1};
bool rev[N];
inline int _abs(int x){
	return x<0?-x:x;
}
int main(){
	int n;
	scanf("%d",&n);
	register int i,j,k;
	for(i=1;i<=n;++i)
		for(j=1;j<=n;++j)
			cin>>A[i][j];
	int m=(n+1)>>1;
	int re=-1<<30;
	for(int S=0;S<(1<<m);++S){
		for(i=1;i<=m;++i)
			rev[i]=(S>>(i-1))&1;
		for(i=m+1;i<=n;++i)
			rev[i]=rev[i-m]^rev[m];
		int sum=0;
		for(j=1;j<=n;++j)
			sum+=d[rev[j]]*A[m][j];
		for(i=1;i<m;++i){
			int Maxadd=-1<<30,add;
			for(k=0;k<2;++k){
				add=0;
				add+=d[k]*A[i][m];
				add+=d[k^rev[m]]*A[i+m][m];
				for(j=1;j<m;++j)
					add+=_abs(A[i][j]+A[i][m+j]*d[k]+A[i+m][j]*d[rev[j]]+A[i+m][j+m]*d[rev[j]]*d[k]);
				Maxadd=max(Maxadd,add);
			}
			sum+=Maxadd;
		}
		re=max(re,sum);
	}
	printf("%d",re);
	return 0;
}


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

#define N 35
int A[N][N],d[]={1,-1};
bool rev[N];
inline int _abs(int x){
	return x<0?-x:x;
}
int main(){
	int n;
	scanf("%d",&n);
	register int i,j,k;
	for(i=1;i<=n;++i)
		for(j=1;j<=n;++j)
			cin>>A[i][j];
	int m=(n+1)>>1;
	int re=-1<<30;
	for(int S=0;S<(1<<m);++S){
		for(i=1;i<=m;++i)
			rev[i]=(S>>(i-1))&1;
		for(i=m+1;i<=n;++i)
			rev[i]=rev[i-m]^rev[m];
		int sum=0;
		for(j=1;j<=n;++j)
			sum+=d[rev[j]]*A[m][j];
		for(i=1;i<m;++i){
			int Maxadd=-1<<30,add;
			for(k=0;k<2;++k){
				add=0;
				add+=d[k]*A[i][m];
				add+=d[k]*d[rev[m]]*A[i+m][m];
				for(j=1;j<m;++j)
					add+=_abs(A[i][j]+A[i][m+j]*d[k]+A[i+m][j]*d[rev[j]]+A[i+m][j+m]*d[rev[j]]*d[k]*d[rev[m]]);
				Maxadd=max(Maxadd,add);
			}
			sum+=Maxadd;
		}
		re=max(re,sum);
	}
	printf("%d",re);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAXN = 33 + 10;

typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
#define x first
#define y second
#define mp make_pair

int s[MAXN][MAXN], N, n, m, a[MAXN * MAXN][MAXN * MAXN], tot, cnt[MAXN];
Pip t[MAXN * MAXN];

void init()
{
	scanf("%d", &n);
	m = n / 2 + 1;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j)
			scanf("%d", &s[i][j]),
			t[++tot] = mp(-abs(s[i][j]), mp(i, j));
}
int calc(int x, int y)
{
	return (x - 1) * m + y;
}
bool check(int a, int b, int x, int y)
{
	return ((x <= a && a < x + m) && (y <= b && b < y + m));
}
int X[MAXN * MAXN];
void Print()
{
	for (int i = 1; i <= N; ++i, puts(""))
		for (int j = 0; j <= N; ++j)
			printf("%d ", a[i][j]);
}
void Gauss()
{
	N = m * m;
//	Print();
	for (int i = 1; i <= N; ++i)
	{
		for (int j = i; j <= N; ++j)
			if (a[j][i])
			{
				swap(a[j][0], a[i][0]);
				for (int k = i; k <= N; ++k)
					swap(a[j][k], a[i][k]);
				break;
			}
		for (int j = i + 1; j <= N; ++j)
			if (a[j][i])
			{
				a[j][0] ^= a[i][0];
				for (int k = i; k <= N; ++k)
					a[j][k] ^= a[i][k];
			}
	}
	X[N] = a[N][0];
	for (int i = N - 1; i >= 1; --i)
	{
		for (int j = i + 1; j <= N; ++j)
			if (a[i][j])
				a[i][0] ^= X[j];
		X[i] = a[i][0];
	}
}
void solve()
{
	sort(t + 1, t + tot + 1);
	for (int i = 1, T = 0; i <= tot && T < m * m; ++i)
	{
		if (cnt[t[i].y.x] >= m)
			continue ;
		++cnt[t[i].y.x]; ++T;
//		cout << t[i].y.x << " " << t[i].y.y << " " << s[t[i].y.x][t[i].y.y] << endl;
		a[T][0] = (s[t[i].y.x][t[i].y.y] >= 0) ? (0) : (1);
//		cout << a[T][0] << endl;
		for (int x = 1; x <= m; ++x)
			for (int y = 1; y <= m; ++y)
				if (check(t[i].y.x, t[i].y.y, x, y))
				{
					a[T][calc(x, y)] = 1;
				}
	}
	Gauss();
//	for (int i = 1; i <= N; ++i)
//		cout << X[i] << endl;
	int CC = 0;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j)
		{
			for (int x = 1; x <= m; ++x)
				for (int y = 1; y <= m; ++y)
					if (check(i, j, x, y) && X[calc(x, y)])
						s[i][j] *= -1;
			CC += s[i][j];
		}
	cout << CC << endl;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#endif
	init();
	solve();
	fclose(stdin);
	fclose(stdout);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    vector <string> a;
    vector <string> b;
    string str = "";
    for(int i = 0; i <= s.size(); i++)
    {
        if(s[i] != ';' and s[i] != ',' and (i != s.size()))
            str = str + s[i];
        else
        {
            int flag = 1;
            for(char c : str)
            {
                if(c >= '0' and c <= '9')
                    continue;
                else
                {
                    flag = 0;
                    break;
                }
            }
            int check = 1;

            if(flag == 1)
            {
                if(str[0] == '0')
                    check = 0;
                if(check == 0)
                    for(char c : str)
                        if(c >= '1' and c <= '9')
                        {
                            flag = 0;
                            break;
                        }
            }

            if(flag == 1 and str.size() != 0)
            {
                a.push_back(str);
            }
            else
                b.push_back(str);
            str = "";
        }
    }
    if(a.size() == 0)
        cout << "-" << endl;
    else if(a.size() == 1)
        cout << '"' << a[0] << '"' << endl;
    else
    {
        cout << '"';
        for(int i = 0; i < a.size() - 1; i++)
            cout << a[i] << ',';
        cout << a[a.size() - 1];
        cout << '"' << endl;
    }
    if(b.size() == 0)
        cout << "-" << endl;
    else if(b.size() == 1)
        cout << '"' << b[0] << '"' << endl;
    else
    {
        cout << '"';
        for(int i = 0; i < b.size() - 1; i++)
            cout << b[i] << ',';
        cout << b[b.size() - 1];
        cout << '"' << endl;
    }

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    vector <string> a;
    vector <string> b;
    string str = "";
    int length = s.size();
    if(s[s.size() - 1] == ';' or s[s.size() - 1] == ',')
    {

    }
    else
        length++;
    for(int i = 0; i < length; i++)
    {
        if(s[i] != ';' and s[i] != ',' and (i != s.size()))
            str = str + s[i];
        else
        {
            int flag = 1;
            for(char c : str)
            {
                if(c >= '0' and c <= '9')
                    continue;
                else
                {
                    flag = 0;
                    break;
                }
            }
            int check = 1;

            if(flag == 1)
            {
                if(str[0] == '0')
                    check = 0;
                if(check == 0)
                    for(char c : str)
                        if(c >= '1' and c <= '9')
                        {
                            flag = 0;
                            break;
                        }
            }

            if(flag == 1 and str.size() != 0)
            {
                a.push_back(str);
            }
            else
                b.push_back(str);
            str = "";
        }
    }
    if(a.size() == 0)
        cout << "-" << endl;
    else if(a.size() == 1)
        cout << '"' << a[0] << '"' << endl;
    else
    {
        cout << '"';
        for(int i = 0; i < a.size() - 1; i++)
            cout << a[i] << ',';
        cout << a[a.size() - 1];
        cout << '"' << endl;
    }
    if(b.size() == 0)
        cout << "-" << endl;
    else if(b.size() == 1)
        cout << '"' << b[0] << '"' << endl;
    else
    {
        cout << '"';
        for(int i = 0; i < b.size() - 1; i++)
            cout << b[i] << ',';
        cout << b[b.size() - 1];
        cout << '"' << endl;
    }

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string s;
    cin >> s;
    vector <string> a;
    vector <string> b;
    string str = "";
    int length = s.size();
    for(int i = 0; i <= length; i++)
    {
        if(s[i] != ';' and s[i] != ',' and (i != s.size()))
            str = str + s[i];
        else
        {
            int flag = 1;
            for(char c : str)
            {
                if(c >= '0' and c <= '9')
                    continue;
                else
                {
                    flag = 0;
                    break;
                }
            }
            int check = 1;

            if(flag == 1)
            {
                if(str[0] == '0')
                    check = 0;
                if(check == 0)
                    for(char c : str)
                        if(c >= '1' and c <= '9')
                        {
                            flag = 0;
                            break;
                        }
            }

            if(flag == 1 and str.size() != 0)
            {
                if(check == 0 and str.size() >= 2)
                    b.push_back(str);
                else
                    a.push_back(str);
            }
            else
                b.push_back(str);
            str = "";
        }
    }
    if(a.size() == 0)
        cout << "-" << endl;
    else if(a.size() == 1)
        cout << '"' << a[0] << '"' << endl;
    else
    {
        cout << '"';
        for(int i = 0; i < a.size() - 1; i++)
            cout << a[i] << ',';
        cout << a[a.size() - 1];
        cout << '"' << endl;
    }
    if(b.size() == 0)
        cout << "-" << endl;
    else if(b.size() == 1)
        cout << '"' << b[0] << '"' << endl;
    else
    {
        cout << '"';
        for(int i = 0; i < b.size() - 1; i++)
            cout << b[i] << ',';
        cout << b[b.size() - 1];
        cout << '"' << endl;
    }

}


#include <iostream>
#include <vector>
using namespace std ;
vector<string> a , b ;
string s , tmp ;
bool A=true ;
 int main() {
	cin >>s;
	for (int i=0 ; i<s.size() ; i++ ){
		if ( s[i]==';' || s[i]==','){
			if (tmp[0]=='0' && tmp.size()==1 )
				A=false ;
			else if (tmp[0]=='0' && tmp.size()>1 )
				A=true;
			else{
				for(int j=0 ; j<tmp.size();j++ )
					if ( tmp[j]!='1' &&tmp[j]!='2' &&tmp[j]!='3' &&tmp[j]!='4' &&tmp[j]!='5' &&tmp[j]!='6' &&tmp[j]!='7' &&tmp[j]!='8' &&tmp[j]!='9'){
						A=true;
						break;
					}
					else
						A=false ;
			}
			if( !A )
				a.push_back(tmp);
			else
				b.push_back(tmp);

			tmp="";
			A=true;
		}
		else
			tmp+=s[i];
	}
	if (tmp[0]=='0' && tmp.size()==1 )
			A=false ;
	else if (tmp[0]=='0' && tmp.size()>1 )
			A=true;
	else{
		for(int j=0 ; j<tmp.size();j++ )
			if ( tmp[j]!='1' &&tmp[j]!='2' &&tmp[j]!='3' &&tmp[j]!='4' &&tmp[j]!='5' &&tmp[j]!='6' &&tmp[j]!='7' &&tmp[j]!='8' &&tmp[j]!='9'){
				A=true;
				break;
			}
			else
				A=false ;
	}
	if(!A)
		a.push_back(tmp);
	else
		b.push_back(tmp);
	if ( a.empty() )
		cout<<"-"<<endl;
	else {
		cout<<"\"" ;
		for(int i=0 ; i<a.size() ; i++ ){
			if ( i!=0 )
				cout<<',';
			cout<<a[i];
		}
		cout<<"\""<<endl ;
	}
	if ( b.empty() )
		cout<<"-"<<endl;
	else {
		cout<<"\"" ;
		for(int i=0 ; i<b.size() ; i++ ){
			if ( i!=0 )
				cout<<',';
			cout<<b[i];
		}
		cout<<"\"" ;
	}
		return 0 ;
	}


#include <iostream>
#include <vector>
using namespace std ;
vector<string> a , b ;
string s , tmp ;
bool A=true ;
 int main() {
	cin >>s;
	for (int i=0 ; i<s.size() ; i++ ){
		if ( s[i]==';' || s[i]==','){
			if (tmp[0]=='0' && tmp.size()==1 )
				A=false ;
			else if (tmp[0]=='0' && tmp.size()>1 )
				A=true;
			else{
				for(long long  j=0 ; j<tmp.size();j++ )
					if (tmp[j]>='0'&&tmp[j]<='9')
						A=false;
					else {
						A=true;
						break;
					}
			}
			if( !A )
				a.push_back(tmp);
			else
				b.push_back(tmp);
			tmp="";
			A=true;
		}
		else
			tmp+=s[i];
	}
	if (tmp[0]=='0' && tmp.size()==1 )
			A=false ;
	else if (tmp[0]=='0' && tmp.size()>1 )
			A=true;
	else{
				for(long long  j=0 ; j<tmp.size();j++ )
					if (tmp[j]>='0'&&tmp[j]<='9')
						A=false;
					else {
						A=true;
						break;
					}
			}
	if(!A)
		a.push_back(tmp);
	else
		b.push_back(tmp);
	if ( a.empty() )
		cout<<"-"<<endl;
	else {
		cout<<"\"" ;
		for(int i=0 ; i<a.size() ; i++ ){
			if ( i!=0 )
				cout<<',';
			cout<<a[i];
		}
		cout<<"\""<<endl ;
	}
	if ( b.empty() )
		cout<<"-"<<endl;
	else {
		cout<<"\"" ;
		for(int i=0 ; i<b.size() ; i++ ){
			if ( i!=0 )
				cout<<',';
			cout<<b[i];
		}
		cout<<"\"" ;
	}
		return 0 ;
	}


	#include <iostream>
	#include <vector>
	using namespace std ;
	vector<string> a , b ;
	string s , tmp ;
	bool A=true ;
	int j ;
	int main() {
		cin >>s;
		for (int i=0 ; i<s.size() ; i++ ){
			if (s[i]!=',' && s[i]!=';'){
				if ( !(s[i]>='0' && s[i]<='9'))
					A=false;
				tmp+=s[i];
			}
			if (s[i]==',' || s[i]==';'){
				if ( tmp[0]=='0' && tmp.size()>1){
					A=false;
					b.push_back(tmp) ;
				}
				else {
					if (A)
						a.push_back(tmp);
					else
						b.push_back(tmp);
				}
				tmp="";
				A=true;
			}
		}
		if ( tmp[0]=='0' && tmp.size()>1){
				A=false;
				b.push_back(tmp) ;
		}
		else {
			if (A)
				a.push_back(tmp) ;
			else
				b.push_back(tmp) ;
		}
		if ( a.empty() )
			cout<<"-"<<endl;
		else {
			cout<<"\"" ;
			for(int i=0 ; i<a.size() ; i++ ){
				if ( i!=0 ) cout<<',';
				cout<<a[i];
			}
			cout<<"\"" ;
		}
		cout<<endl;
		if ( b.empty() )
			cout<<"-"<<endl;
		else {
			cout<<"\"" ;
			for(int i=0 ; i<b.size() ; i++ ){
				if ( i!=0 ) cout<<',';
				cout<<b[i];
			}
			cout<<"\"" ;
		}
		return 0 ;
	}


	#include <iostream>
	using namespace std ;
	string s , a , b , tmp ;
	bool A=true ;
	int j ;
	int main() {
		cin >>s;
		for (int i=0 ; i<s.size() ; i++ ){
			if (s[i]!=',' && s[i]!=';'){
				if ( !(s[i]>='0' && s[i]<='9'))
					A=false;
				tmp+=s[i];
			}
			if (s[i]==',' || s[i]==';'){
				if ( tmp[0]=='0' && tmp.size()>1){
					A=false;
					b+=tmp ;
					b+=s[i];
				}
				else {
					if (A){
						a+=tmp ;
						a+=s[i];
					}
					else{
						b+=tmp ;
						b+=s[i];
					}
				}
				tmp="";
				A=true;
			}
		}
		if ( tmp[0]=='0' && tmp.size()>1){
				A=false;
				b+=tmp ;
		}
		else {
			if (A)
				a+=tmp ;
			else
				b+=tmp ;
		}
		if ( a.empty() )
			a='-' ;
		if (b.empty() )
			b='-';
		cout<<'"' <<a<< '"' << endl << '"' <<b<< '"' ;
		return 0 ;
	}


#include <iostream>
#include <vector>
using namespace std ;
vector<string> a , b ;
string s , tmp ;
bool A=true ;
 int main() {
	cin >>s;
	for (int i=0 ; i<s.size() ; i++ ){
		if ( s[i]==';' || s[i]==','){
			if (tmp[0]=='0' && tmp.size()==1 )
				A=false ;
			else if (tmp[0]=='0' && tmp.size()>1 )
				A=true;
			else{
				for(long long  j=0 ; j<tmp.size();j++ )
					if (tmp[j]<'0' || tmp[j]>'9'){
						A=true;
						break;
					}
					else
						A=false ;
			}
			if( !A )
				a.push_back(tmp);
			else
				b.push_back(tmp);

			tmp="";
			A=true;
		}
		else
			tmp+=s[i];
	}
	if (tmp[0]=='0' && tmp.size()==1 )
			A=false ;
	else if (tmp[0]=='0' && tmp.size()>1 )
			A=true;
	else{
		for(int j=0 ; j<tmp.size();j++ )
			if ( tmp[j]!='1' &&tmp[j]!='2' &&tmp[j]!='3' &&tmp[j]!='4' &&tmp[j]!='5' &&tmp[j]!='6' &&tmp[j]!='7' &&tmp[j]!='8' &&tmp[j]!='9'){
				A=true;
				break;
			}
			else
				A=false ;
	}
	if(!A)
		a.push_back(tmp);
	else
		b.push_back(tmp);
	if ( a.empty() )
		cout<<"-"<<endl;
	else {
		cout<<"\"" ;
		for(int i=0 ; i<a.size() ; i++ ){
			if ( i!=0 )
				cout<<',';
			cout<<a[i];
		}
		cout<<"\""<<endl ;
	}
	if ( b.empty() )
		cout<<"-"<<endl;
	else {
		cout<<"\"" ;
		for(int i=0 ; i<b.size() ; i++ ){
			if ( i!=0 )
				cout<<',';
			cout<<b[i];
		}
		cout<<"\"" ;
	}
		return 0 ;
	}


#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

bool isValidNumber(string s) {
	if(s=="") return false;
	int flag=0;
	for(auto x: s) {
		if(x<48 || x>57) return false;
		if(x>=49 && x<=57) flag=1;
	}
	if(flag && s[0]=='0') return false;
	return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;
    ll i=0;
    string res="";
    vector<string> v;

    while(s[i]) {
    	if(s[i]==',' || s[i]==';') {
    		v.pb(res);
    		res="";
    	} else {
    		res+=s[i];
    	}
    	i++;
    }
    v.pb(res);

    vector<string> a,b;
    for(auto s: v) {
    	if(isValidNumber(s)) a.pb(s);
    	else b.pb(s);
    }

    if(a.size()) {
    	cout << '"';
	   	for(i=0;i<a.size()-1;i++) {
	   		cout << a[i] << ',';
	   	}
	   	cout << a[i] << '"';
   	} else cout << '-';
   	cout << "\n";

   	if(b.size()) {
   		cout << '"';
   		for(i=0;i<b.size()-1;i++) {
   			cout << b[i] << ',';
   		}
   		cout << b[i] << '"';
   	} else cout << '-';
   	cout << "\n";
    return 0;
}


#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

bool isValidNumber(string s) {
	if(s=="") return false;
	if(s.length()>=2 && s[0]=='0') return false;
	for(auto x: s) {
		if(x<48 || x>57) return false;
	}
	return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;
    ll i=0;
    string res="";
    vector<string> v;

    while(s[i]) {
    	if(s[i]==',' || s[i]==';') {
    		v.pb(res);
    		res="";
    	} else {
    		res+=s[i];
    	}
    	i++;
    }
    v.pb(res);

    vector<string> a,b;
    for(auto s: v) {
    	if(isValidNumber(s)) a.pb(s);
    	else b.pb(s);
    }

    if(a.size()) {
    	cout << '"';
	   	for(i=0;i<a.size()-1;i++) {
	   		cout << a[i] << ',';
	   	}
	   	cout << a[i] << '"';
   	} else cout << '-';
   	cout << "\n";

   	if(b.size()) {
   		cout << '"';
   		for(i=0;i<b.size()-1;i++) {
   			cout << b[i] << ',';
   		}
   		cout << b[i] << '"';
   	} else cout << '-';
   	cout << "\n";

    return 0;
}


#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

bool isValidNumber(string s) {
	if(s=="") return false;
	int flag=0;
	for(auto x: s) {
		if(x<48 || x>57) return false;
		if(x>=49 && x<=57) flag=1;
	}
	if(flag && s[0]=='0') return false;
	return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;
    ll i=0;
    string res="";
    vector<string> v;

    while(s[i]) {
    	if(s[i]==',' || s[i]==';') {
    		v.pb(res);
    		res="";
    	} else if(s[i]!='.') {
    		res+=s[i];
    	}
    	i++;
    }
    v.pb(res);

    // for(auto s: v) cout << s << ' ';
    // cout << "\n";

    vector<string> a,b;
    for(auto s: v) {
    	if(isValidNumber(s)) a.pb(s);
    	else b.pb(s);
    }

    if(a.size()) {
    	cout << '"';
	   	for(i=0;i<a.size()-1;i++) {
	   		cout << a[i] << ',';
	   	}
	   	cout << a[i] << '"';
   	} else cout << '-';
   	cout << "\n";

   	if(b.size()) {
   		cout << '"';
   		for(i=0;i<b.size()-1;i++) {
   			cout << b[i] << ',';
   		}
   		cout << b[i] << '"';
   	} else cout << '-';
   	cout << "\n";
    return 0;
}


#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

bool isValidNumber(string s) {
	if(s=="") return false;
	int flag=0;
	for(auto x: s) {
		if(x<48 || x>57) return false;
		if(x>=49 && x<=57) flag=1;
	}
	if(!flag && s[0]=='0') return false;
	return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;
    ll i=0;
    string res="";
    vector<string> v;

    while(s[i]) {
    	if(s[i]==',' || s[i]==';') {
    		v.pb(res);
    		res="";
    	} else {
    		res+=s[i];
    	}
    	i++;
    }
    v.pb(res);

    vector<string> a,b;
    for(auto s: v) {
    	if(isValidNumber(s)) a.pb(s);
    	else b.pb(s);
    }

    if(a.size()) {
    	cout << '"';
	   	for(i=0;i<a.size()-1;i++) {
	   		cout << a[i] << ',';
	   	}
	   	cout << a[i] << '"';
   	} else cout << '-';
   	cout << "\n";

   	if(b.size()) {
   		cout << '"';
   		for(i=0;i<b.size()-1;i++) {
   			cout << b[i] << ',';
   		}
   		cout << b[i] << '"';
   	} else cout << '-';
   	cout << "\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    string st,s1,s2,tem,fn;
    int sz,i,flg,j;
    cin >> st;
    sz = st.size();
    for(i=0;i<sz;i++)
    {
        tem ="";
        for(j=i;j<sz;j++)
        {
            if(st[j]==';' || st[j]==',' ) break;
            tem+= st[j];
        }
        int sz2 = tem.size();
        int ff=0;
        for(j=0;j<sz2;j++)
        {
            if(tem[0]!='0' && tem[j]>='0' && tem[j]<='9') fn+=tem[j];
            else ff=1;
        }

        if(ff)
        {
            if(s2.size()) s2+=',';
            s2+=tem;
        }
        else
        {
            s1+=fn;
            if(s1.size()) s1+=',';
        }
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pb push_back
typedef vector<int> vi;

int main() {
    string input, a = "", b = "";
    queue<int> wordBreak;
    cin >> input;

    for(int i = 0; i < input.length(); i++) if(input[i] == ',' || input[i] == ';') wordBreak.push(i);

    bool _a = true;
    bool upA = false;
    bool upB = false;
    string currString = "";
    int newWord = wordBreak.front();
    wordBreak.pop();

    for(int i = 0; i < input.length(); i++) {
        if(i == newWord) {
            newWord = wordBreak.front();
            wordBreak.pop();

            if(_a && !currString.empty()) upA = true, a = a + currString + ",";
            else upB = true, b = b + currString + ",";

            currString = "";
            _a = true;
            if(i < input.length()-1 && input[i+1] == '0' && i+2 < input.length() && i+2 != newWord) _a = false;
        }
        else {
            if((int)input[i] < 48 || (int)input[i] > 57) _a = false;
            currString = currString + input[i];
        }
    }

    if(_a && !currString.empty()) upA = true, a = a + currString + ",";
    else upB = true, b = b + currString + ",";

    if(!a.empty()) a = a.substr(0, a.length()-1);
    if(!b.empty()) b = b.substr(0, b.length()-1);

    if(upA) cout << (char)34 << a << (char)34 << endl;
    else cout << (char)45 << endl;

    if(upB) cout << (char)34 << b << (char)34;
    else cout << (char)45;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pb push_back
typedef vector<int> vi;

int main() {
    string input, a, b;
    queue<int> wordBreak;
    cin >> input;

    for(int i = 0; i < input.length(); i++) if(input[i] == ',' || input[i] == ';') wordBreak.push(i);

    bool _a = true;
    string currString = "";
    int newWord = wordBreak.front();
    wordBreak.pop();

    for(int i = 0; i < input.length(); i++) {
        if(i == newWord) {
            if(_a && !currString.empty()) a = a + currString + ",";
            else b = b + currString + ",";

            currString = "";
            _a = true;
            if(i < input.length()-1 && input[i+1] == '0') _a = false;
            newWord = wordBreak.front();
            wordBreak.pop();
        }
        else {
            if((int)input[i] < 48 || (int)input[i] > 57) _a = false;
            currString = currString + input[i];
        }
    }
    if(_a && !currString.empty()) a = a + currString + ",";
    else b = b + currString + ",";

    if(!a.empty()) a = a.substr(0, a.length()-1);
    if(!b.empty()) b = b.substr(0, b.length()-1);

    if(!a.empty()) cout << (char)34 << a << (char)34 << endl;
    else cout << (char)45 << endl;

    if(!b.empty()) cout << (char)34 << b << (char)34;
    else cout << (char)45;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pb push_back
typedef vector<int> vi;

int main() {
    string input, a, b;
    queue<int> wordBreak;
    cin >> input;

    for(int i = 0; i < input.length(); i++) if(input[i] == ',' || input[i] == ';') wordBreak.push(i);

    bool _a = true;
    string currString = "";
    int newWord = wordBreak.front();
    wordBreak.pop();

    for(int i = 0; i < input.length(); i++) {
        if(i == newWord) {
            newWord = wordBreak.front();
            wordBreak.pop();

            if(_a && !currString.empty()) a = a + currString + ",";
            else b = b + currString + ",";

            currString = "";
            _a = true;
            if(i < input.length()-1 && input[i+1] == '0' && i+2 < input.length() && i+2 != newWord) _a = false;
        }
        else {
            if((int)input[i] < 48 || (int)input[i] > 57) _a = false;
            currString = currString + input[i];
        }
    }
    if(_a && !currString.empty()) a = a + currString + ",";
    else b = b + currString + ",";

    if(!a.empty()) a = a.substr(0, a.length()-1);
    if(!b.empty()) b = b.substr(0, b.length()-1);

    if(!a.empty()) cout << (char)34 << a << (char)34 << endl;
    else cout << (char)45 << endl;

    if(!b.empty()) cout << (char)34 << b << (char)34;
    else cout << (char)45;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pb push_back
typedef vector<int> vi;

int main() {
    string input, a, b;
    queue<int> wordBreak;
    cin >> input;

    for(int i = 0; i < input.length(); i++) if(input[i] == ',' || input[i] == ';') wordBreak.push(i);

    bool _a = true;
    string currString = "";
    int newWord = wordBreak.front();
    wordBreak.pop();

    for(int i = 0; i < input.length(); i++) {
        if(i == newWord) {
            newWord = wordBreak.front();
            wordBreak.pop();

            if(_a && !currString.empty()) a = a + currString + ",";
            else b = b + currString + ",";

            currString = "";
            _a = true;
            if(i < input.length()-1 && input[i+1] == '0' && i+2 < input.length() && i+2 != newWord) _a = false;
        }
        else {
            if((int)input[i] < 48 || (int)input[i] > 57) _a = false;
            currString = currString + input[i];
        }
    }
    if(_a && !currString.empty()) a = a + currString + ",";
    else b = b + currString + ",";

    if(input.back() == ',' || input.back() == ';') b = b + ",";

    if(!a.empty()) a = a.substr(0, a.length()-1);
    if(!b.empty()) b = b.substr(0, b.length()-1);

    if(!a.empty()) cout << (char)34 << a << (char)34 << endl;
    else cout << (char)45 << endl;

    if(!b.empty()) cout << (char)34 << b << (char)34;
    else cout << (char)45;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pb push_back
typedef vector<int> vi;

int main() {
    string input, a = "", b = "";
    queue<int> wordBreak;
    cin >> input;

    for(int i = 0; i < input.length(); i++) if(input[i] == ',' || input[i] == ';') wordBreak.push(i);

    bool _a = true;
    bool upA = false;
    bool upB = false;
    string currString = "";
    int newWord = wordBreak.front();
    wordBreak.pop();

    for(int i = 0; i < input.length(); i++) {
        if(i == newWord) {
            newWord = wordBreak.front();
            wordBreak.pop();

            if(_a && !currString.empty() && (currString.length() == 1 || currString[0] != '0')) upA = true, a = a + currString + ",";
            else upB = true, b = b + currString + ",";

            currString = "";
            _a = true;
        }
        else {
            if((int)input[i] < 48 || (int)input[i] > 57) _a = false;
            currString = currString + input[i];
        }
    }

    if(_a && !currString.empty() && (currString.length() == 1 || currString[0] != '0')) upA = true, a = a + currString + ",";
    else upB = true, b = b + currString + ",";

    if(!a.empty()) a = a.substr(0, a.length()-1);
    if(!b.empty()) b = b.substr(0, b.length()-1);

    if(upA) cout << (char)34 << a << (char)34 << endl;
    else cout << (char)45 << endl;

    if(upB) cout << (char)34 << b << (char)34;
    else cout << (char)45;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <set>

using namespace std;
#define lowbit(i) (i & (-i))
#define eps 1e-7
#define GETMID int mid = (l + r) >> 1
#define lson u << 1
#define rson u << 1 | 1
#define Lson u << 1, l, mid
#define Rson u << 1 | 1, mid + 1, r
#define Maxn (100000 + 10)
typedef long long LL;

string s, a, b, cur;
int kind, aflag = 0, bflag = 0;

int getkind() {
	if(cur.size() == 0) return 0;
	if(cur[0] == '0') {
		if(cur.size() == 1) return 1;
		return 0;
	}
	for(int i = 0; i < cur.size(); ++i)
		if(cur[i] < '0' || cur[i] > '9') return 0;
	return 1;
}

int main() {
	cin >> s;
	a = "";
	b = "";
	cur = "";

	for(int i = 0; i < s.size(); ++i) {
		if(s[i] == ';' || s[i] == ',') {
			kind = getkind();
			if(kind == 1) {
				if(aflag) a = a + ',';
				a = a + cur;
				aflag = 1;
			}
			else {
				if(bflag) b = b + ',';
				b = b + cur;
				bflag = 1;
			}
			cur = "";
		}
		else cur = cur + s[i];
	}
	kind = getkind();
	if(kind == 1) a = a + ',' + cur;
	else b = b + ',' + cur;

	if(a.size() != 0) cout << '\"' << a << "\"\n";
	else cout << "-\n";
	if(b.size() != 0) cout << '\"' << b << "\"\n";
	else cout << "-\n";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <set>

using namespace std;
#define lowbit(i) (i & (-i))
#define eps 1e-7
#define GETMID int mid = (l + r) >> 1
#define lson u << 1
#define rson u << 1 | 1
#define Lson u << 1, l, mid
#define Rson u << 1 | 1, mid + 1, r
#define Maxn (100000 + 10)
typedef long long LL;

string s, a, b, cur;
int kind;

int getkind() {
	if(cur.size() == 0) return 0;
	if(cur[0] == '0') {
		if(cur.size() == 1) return 1;
		return 0;
	}
	for(int i = 0; i < cur.size(); ++i)
		if(cur[i] < '0' || cur[i] > '9') return 0;
	return 1;
}

int main() {
	cin >> s;
	a = "";
	b = "";
	cur = "";

	for(int i = 0; i < s.size(); ++i) {
		if(s[i] == ';' || s[i] == ',') {
			kind = getkind();
			if(kind == 1) {
				if(a.size() != 0) a = a + ',';
				a = a + cur;
			}
			else {
				if(b.size() != 0) b = b + ',';
				b = b + cur;
			}
			cur = "";
		}
		else cur = cur + s[i];
	}
	kind = getkind();
	if(kind == 1) a = a + ',' + cur;
	else b = b + ',' + cur;

	if(a.size() != 0) cout << '\"' << a << "\"\n";
	else cout << "-\n";
	if(b.size() != 0) cout << '\"' << b << "\"\n";
	else cout << "-\n";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <set>

using namespace std;
#define lowbit(i) (i & (-i))
#define eps 1e-7
#define GETMID int mid = (l + r) >> 1
#define lson u << 1
#define rson u << 1 | 1
#define Lson u << 1, l, mid
#define Rson u << 1 | 1, mid + 1, r
#define Maxn (100000 + 10)
typedef long long LL;

string s, a, b, cur;
int kind, aflag = 0, bflag = 0;

int getkind() {
	if(cur.size() == 0) return 0;
	if(cur[0] == '0') {
		if(cur.size() == 1) return 1;
		return 0;
	}
	for(int i = 0; i < cur.size(); ++i)
		if(cur[i] < '0' || cur[i] > '9') return 0;
	return 1;
}

int main() {
	cin >> s;
	a = "";
	b = "";
	cur = "";

	for(int i = 0; i < s.size(); ++i) {
		if(s[i] == ';' || s[i] == ',') {
			kind = getkind();
			if(kind == 1) {
				if(aflag) a = a + ',';
				a = a + cur;
				aflag = 1;
			}
			else {
				if(bflag) b = b + ',';
				b = b + cur;
				bflag = 1;
			}
			cur = "";
		}
		else cur = cur + s[i];
	}
	kind = getkind();
	if(kind == 1) {
		if(aflag) a = a + ',';
		a = a + cur;
		aflag = 1;
	}
	else {
		if(bflag) b = b + ',';
		b = b + cur;
		bflag = 1;
	}

	if(aflag) cout << '\"' << a << "\"\n";
	else cout << "-\n";
	if(bflag) cout << '\"' << b << "\"\n";
	else cout << "-\n";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <set>

using namespace std;
#define lowbit(i) (i & (-i))
#define eps 1e-7
#define GETMID int mid = (l + r) >> 1
#define lson u << 1
#define rson u << 1 | 1
#define Lson u << 1, l, mid
#define Rson u << 1 | 1, mid + 1, r
#define Maxn (100000 + 10)
typedef long long LL;

string s, a, b, cur;
int kind, aflag = 0, bflag = 0;

int getkind() {
	if(cur.size() == 0) return 0;
	if(cur[0] == '0') {
		if(cur.size() == 1) return 1;
		return 0;
	}
	for(int i = 0; i < cur.size(); ++i)
		if(cur[i] < '0' || cur[i] > '9') return 0;
	return 1;
}

int main() {
	cin >> s;
	a = "";
	b = "";
	cur = "";

	for(int i = 0; i < s.size(); ++i) {
		if(s[i] == ';' || s[i] == ',') {
			kind = getkind();
			if(kind == 1) {
				if(aflag) a = a + ',';
				a = a + cur;
				aflag = 1;
			}
			else {
				if(bflag) b = b + ',';
				b = b + cur;
				bflag = 1;
			}
			cur = "";
		}
		else cur = cur + s[i];
	}
	kind = getkind();
	if(kind == 1) a = a + ',' + cur;
	else b = b + ',' + cur;

	if(aflag) cout << '\"' << a << "\"\n";
	else cout << "-\n";
	if(bflag) cout << '\"' << b << "\"\n";
	else cout << "-\n";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int tmax=1e5+5;
char s[tmax],zero='\0';
string num[tmax],ss[tmax];
int n,m;
void work(int l,int r)
{
    if(r<l)
    {
        ss[++m]="";
        return;
    }
    bool dig=true;
    if(s[l]=='0'&&r-l+1>1) dig=false;
    for(int i=l;i<=r;i++)
        if(s[i]<'0'||s[i]>'9') dig=false;
    swap(zero,s[r+1]);
    if(dig) num[++n]=&s[l];
    else ss[++m]=&s[l];
    swap(zero,s[r+1]);
    return;
}
int main()
{
    scanf("%s",s);
    int l=0,r=0,len=strlen(s);
    while(r<=len)
    {
        if(s[r]==','||s[r]==';'||s[r]=='\0')
        {
            work(l,r-1);
            l=r+1;
        }
        r++;
    }
    if(n==0) printf("-\n");
    else {
        printf("%c",34);
        cout<<num[1];
        for(l=2;l<=n;l++)
            cout<<','<<num[l];
        printf("%c\n",34);
    }
    if(m==0) printf("-\n");
    else {
        printf("%c",34);
        cout<<ss[1];
        for(l=2;l<=m;l++)
            cout<<','<<ss[l];
        printf("%c",34);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int check(string ss)
{
	if(!ss.size()){
		return 0;
	}
	if(ss.size()!=1&&ss[0]=='0'){
		return 0;
	}
	for(int i=0;i<ss.size();i++){
		if(ss[i]<'0'||ss[i]>'9'){
			return 0;
		}
	}
	return 1;
}
int main()
{
	string s,a,b;
	vector<string>v;
	cin>>s;
	s+=",";
	int l=s.size();
	int last=0;
	for(int i=0;i<l;i++){
		if(s[i]==','||s[i]==';'){
			v.push_back(s.substr(last,i-last));
			last=i+1;
		}
	}
	for(int i=0;i<v.size();i++){
		if(check(v[i])){
			a+=","+v[i];
		}else{
			b+=","+v[i];
		}
	}
	if(a.size()){
		a[0]='"';
		a+="\"";
		cout<<a<<endl;
	}else{
		cout<<"-"<<endl;
	}
	if(b.size()){
		b[0]='"';
		b+="\"";
		cout<<b<<endl;
	}else{
		cout<<"-"<<endl;
	}
	return 0;
}


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

char buff[100010];
char wd[100010];

string numlist[100010];
int numlen;
string othlist[100010];
int othlen;

bool isnum(char* s){
    int len = strlen(s);
    if(len==0)return false;
    if(s[0]=='0' && len>1)return false;
    for(int i=0;i<len;i++){
        if(s[i]>'9' || s[i]<'0')return false;
    }
    return true;
}

int main(void){

    scanf("%s",buff);
    int len = strlen(buff);
    for(int i=0;i<len;i++){
        if((buff[i]==44)||(buff[i]==59))buff[i]=0;
    }
    buff[len] = 0;

    int p = 0;
    while(p<=len){
        int wdlen = 0;
        while(p<=len && buff[p]){
            wd[wdlen++] = buff[p++];
        }
        wd[wdlen]=0;
        p++;

        if(isnum(wd)){
            numlist[numlen++] = string(wd);
        }else{
            othlist[othlen++] = string(wd);
        }
    }

    if(numlen){
        printf("\"");

        for(int i=0;i<numlen;i++){
            cout<<numlist[i];
            if(i!=(numlen-1))printf(",");
        }

        printf("\"\n");
    }else{
        printf("-\n");
    }

    if(othlen){
        printf("\"");

        for(int i=0;i<othlen;i++){
            cout<<othlist[i];
            if(i!=(othlen-1))printf(",");
        }

        printf("\"\n");
    }else{
        printf("-\n");
    }

    return 0;
}


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

char buff[100010];
char wd[100010];

string numlist[100010];
int numlen;
string othlist[100010];
int othlen;

bool isnum(char* s){
    int len = strlen(s);
    if(s==0)return false;
    if(s[0]=='0' && len>1)return false;
    for(int i=0;i<len;i++){
        if(s[i]>'9' || s[i]<'0')return false;
    }
    return true;
}

int main(void){

    scanf("%s",&buff);
    int len = strlen(buff);
    for(int i=0;i<len;i++){
        if((buff[i]==46)||(buff[i]==44)||(buff[i]==59))buff[i]=0;
    }
    buff[len] = 0;

    int p = 0;
    while(p<=len){
        int wdlen = 0;
        while(p<len && buff[p]){
            wd[wdlen++] = buff[p++];
        }
        wd[wdlen]=0;
        p++;

        if(isnum(wd)){
            numlist[numlen++] = string(wd);
        }else{
            othlist[othlen++] = string(wd);
        }

    }

    if(numlen){
        printf("\"");

        for(int i=0;i<numlen;i++){
            cout<<numlist[i];
            if(i!=(numlen-1))printf(",");
        }

        printf("\"\n");
    }else{
        printf("-\n");
    }

    if(othlen){
        printf("\"");

        for(int i=0;i<othlen;i++){
            cout<<othlist[i];
            if(i!=(othlen-1))printf(",");
        }

        printf("\"\n");
    }else{
        printf("-\n");
    }

    return 0;
}


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

char buff[100010];
char wd[100010];

string numlist[100010];
int numlen;
string othlist[100010];
int othlen;

bool isnum(char* s){
    int len = strlen(s);
    if(len==0)return false;
    if(s[0]=='0' && len>1)return false;
    for(int i=0;i<len;i++){
        if(s[i]>'9' || s[i]<'0')return false;
    }
    return true;
}

int main(void){

    scanf("%s",&buff);
    int len = strlen(buff);
    for(int i=0;i<len;i++){
        if((buff[i]==46)||(buff[i]==44)||(buff[i]==59))buff[i]=0;
    }
    buff[len] = 0;

    int p = 0;
    while(p<=len){
        int wdlen = 0;
        while(p<len && buff[p]){
            wd[wdlen++] = buff[p++];
        }
        wd[wdlen]=0;
        p++;

        if(isnum(wd)){
            numlist[numlen++] = string(wd);
        }else{
            othlist[othlen++] = string(wd);
        }
    }

    if(numlen){
        printf("\"");

        for(int i=0;i<numlen;i++){
            cout<<numlist[i];
            if(i!=(numlen-1))printf(",");
        }

        printf("\"\n");
    }else{
        printf("-\n");
    }

    if(othlen){
        printf("\"");

        for(int i=0;i<othlen;i++){
            cout<<othlist[i];
            if(i!=(othlen-1))printf(",");
        }

        printf("\"\n");
    }else{
        printf("-\n");
    }

    return 0;
}


#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;

int main()
{
	#ifdef SANS
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\inputf.txt","r",stdin);
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\outputf.txt","w",stdout);
	#endif
	fast
	int t=1;
	// cin>>t;
	while(t--)
	{
		string in,temp="";
		cin>>in;
		// cout<<in<<endl;
		// return 0;
		vector<string> Int, Words;
		// cout<<1<<endl;
		for(int i=0; i<in.length(); i++)
		{
			if(in[i]==',' || in[i]==';')
			{
				// cout<<temp<<endl;
				bool isnum=true;
				for(char c : temp)
				{
					if(c<'0' || c>'9')
					{
						isnum=false;
						break;
					}
				}
				if(!isnum || temp=="")Words.push_back(temp);
				else
				{
					stringstream check(temp);
					int num;
					check>>num;
					if((num!=0 && temp[0]=='0')||(num==0 && temp.length()>1))Words.push_back(temp);
					else Int.push_back(temp);
				}
				temp="";
			}
			else
				temp+=in[i];
		}
		// cout<<temp<<endl;
		bool isnum=true;
		for(char c : temp)
		{
			// cout<<c<<endl;
			if(c<'0' || c>'9')
			{
				isnum=false;
				break;
			}
			// cout<<isnum<<endl;
		}
		if(!isnum || temp=="")Words.push_back(temp);
		else
		{
			stringstream check(temp);
			int num;
			check>>num;
			if((num!=0 && temp[0]=='0')||(num==0 && temp.length()>1))Words.push_back(temp);
			else Int.push_back(temp);
		}
		if(Int.size()!=0)
		{
			cout<<"\"";
			for(int i=0; i<Int.size();i++)
			{
				cout<<Int[i];
				if(i!=Int.size()-1)
					cout<<",";
			}
			cout<<"\""<<endl;
		}
		else
			cout<<"-\n";
		if(Words.size()!=0)
		{
			cout<<"\"";
			for(int i=0; i<Words.size();i++)
			{
				cout<<Words[i];
				if(i!=Words.size()-1)
					cout<<",";
			}
			cout<<"\"";
		}
		else
			cout<<"-\n";
	}
	#ifdef SANS
		cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
	#endif
}


#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;

int main()
{
	#ifdef SANS
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\inputf.txt","r",stdin);
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\outputf.txt","w",stdout);
	#endif
	fast
	int t=1;
	// cin>>t;
	while(t--)
	{
		string in,temp="";
		cin>>in;
		// cout<<in<<endl;
		// return 0;
		vector<string> Int, Words;
		// cout<<1<<endl;
		for(int i=0; i<in.length(); i++)
		{
			if(in[i]==',' || in[i]==';' || in[i]=='.')
			{
				// cout<<temp<<endl;
				bool isnum=true;
				for(char c : temp)
				{
					if((c>='a' && c<='z')||(c>='a' && c<='z'))
						isnum=false;
				}
				if(!isnum || temp=="")Words.push_back(temp);
				else
				{
					stringstream check(temp);
					int num;
					check>>num;
					if(num!=0 && temp[0]=='0')Words.push_back(temp);
					else Int.push_back(temp);
				}
				temp="";
			}
			else
				temp+=in[i];
		}
		// cout<<temp<<endl;
		bool isnum=true;
		for(char c : temp)
		{
			if((c>='a' && c<='z')||(c>='a' && c<='z'))
				isnum=false;
		}
		if(!isnum || temp=="")Words.push_back(temp);
		else
		{
			stringstream check(temp);
			int num;
			check>>num;
			if(num!=0 && temp[0]=='0')Words.push_back(temp);
			else Int.push_back(temp);
		}
		if(Int.size()!=0)
		{
			cout<<"\"";
			for(int i=0; i<Int.size();i++)
			{
				cout<<Int[i];
				if(i!=Int.size()-1)
					cout<<",";
			}
			cout<<"\""<<endl;
		}
		else
			cout<<"-\n";
		if(Words.size()!=0)
		{
			cout<<"\"";
			for(int i=0; i<Words.size();i++)
			{
				cout<<Words[i];
				if(i!=Words.size()-1)
					cout<<",";
			}
			cout<<"\"";
		}
		else
			cout<<"-\n";
	}
	#ifdef SANS
		cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
	#endif
}


#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;

int main()
{
	#ifdef SANS
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\inputf.txt","r",stdin);
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\outputf.txt","w",stdout);
	#endif
	fast
	int t=1;
	// cin>>t;
	while(t--)
	{
		string in,temp="";
		cin>>in;
		// cout<<in<<endl;
		// return 0;
		vector<string> Int, Words;
		// cout<<1<<endl;
		for(int i=0; i<in.length(); i++)
		{
			if(in[i]==',' || in[i]==';')
			{
				// cout<<temp<<endl;
				bool isnum=true;
				for(char c : temp)
				{
					if(c<'0' || c>'9')
					{
						isnum=false;
						break;
					}
				}
				if(!isnum || temp=="")Words.push_back(temp);
				else
				{
					stringstream check(temp);
					int num;
					check>>num;
					if(num!=0 && temp[0]=='0')Words.push_back(temp);
					else Int.push_back(temp);
				}
				temp="";
			}
			else
				temp+=in[i];
		}
		// cout<<temp<<endl;
		bool isnum=true;
		for(char c : temp)
		{
			// cout<<c<<endl;
			if(c<'0' || c>'9')
			{
				isnum=false;
				break;
			}
			// cout<<isnum<<endl;
		}
		if(!isnum || temp=="")Words.push_back(temp);
		else
		{
			stringstream check(temp);
			int num;
			check>>num;
			if(num!=0 && temp[0]=='0')Words.push_back(temp);
			else Int.push_back(temp);
		}
		if(Int.size()!=0)
		{
			cout<<"\"";
			for(int i=0; i<Int.size();i++)
			{
				cout<<Int[i];
				if(i!=Int.size()-1)
					cout<<",";
			}
			cout<<"\""<<endl;
		}
		else
			cout<<"-\n";
		if(Words.size()!=0)
		{
			cout<<"\"";
			for(int i=0; i<Words.size();i++)
			{
				cout<<Words[i];
				if(i!=Words.size()-1)
					cout<<",";
			}
			cout<<"\"";
		}
		else
			cout<<"-\n";
	}
	#ifdef SANS
		cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
	#endif
}


/*IN The Name of GOD*/
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

vector <char> vca, vcb;

bool mrk = true;

int main()
{
	string s;
	cin >> s;

	int st = 0;
	while(st < s.size()){
		bool check = true;

		int end = s.size();
		for(int i = st; i <= s.size(); i++){
			if(s[i]==',' || s[i]==';' || i==s.size()){
				end = i;
				break;
			}

			if(i==st && s[i]=='0' && st!=s.size()-1 && (s[i+1]!=','||s[i+1]!=';'))
				check = false;
			else if(s[i]<'0' || s[i]>'9')
				check = false;
		}

		if(st == end)
			vcb.pb(',');

		else if(check){
			for(int i = st; i < end; i++)
				vca.pb(s[i]);

			vca.pb(',');
		}

		else{
			for(int i = st; i < end; i++)
				vcb.pb(s[i]);

			vcb.pb(',');
		}

		st = end+1;
	}

	if(!vca.size())
		cout << '-' << endl;

	else{
		cout << '"';
		for(int i = 0; i < vca.size()-1; i++)
			cout << vca[i];
		cout << '"' << endl;
	}

	if(!vcb.size())
		cout << '-';

	else{
		cout << '"';
		for(int i = 0; i < vcb.size()-1; i++)
			cout << vcb[i];
		cout << '"';
	}

	return 0;
}


/*IN The Name of GOD*/
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

vector <char> vca, vcb;

bool mrk = true;

int main()
{
	string s;
	cin >> s;

	int st = 0;
	while(st <= s.size()){
		bool check = true;

		int end = s.size();
		for(int i = st; i <= s.size(); i++){
			if(s[i]==',' || s[i]==';' || i==s.size()){
				end = i;
				break;
			}

			if(i==st && s[i]=='0' && st!=s.size()-1 && (s[i+1]!=','||s[i+1]!=';'))
				check = false;
			else if(s[i]<'0' || s[i]>'9')
				check = false;
		}
		//cout << st << ' ' << end << endl;
		if(st == end)
			vcb.pb(',');

		else if(check){
			for(int i = st; i < end; i++)
				vca.pb(s[i]);

			vca.pb(',');
		}

		else{
			for(int i = st; i < end; i++)
				vcb.pb(s[i]);

			vcb.pb(',');
		}

		st = end+1;
	}

	if(!vca.size())
		cout << '-' << endl;

	else{
		cout << '"';
		for(int i = 0; i < vca.size()-1; i++)
			cout << vca[i];
		cout << '"' << endl;
	}

	if(!vcb.size())
		cout << '-';

	else{
		cout << '"';
		for(int i = 0; i < vcb.size()-1; i++)
			cout << vcb[i];
		cout << '"';
	}

	return 0;
}


/*IN The Name of GOD*/
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

vector <char> vca, vcb;

bool mrk = true;

int main()
{
	string s;
	cin >> s;

	int st = 0;
	while(st < s.size()){
		bool check = true;

		int end = s.size();
		for(int i = st; i <= s.size(); i++){
			if(s[i]==',' || s[i]==';' || i==s.size()){
				end = i;
				break;
			}

			if(i==st && s[i]=='0' && st!=s.size()-1 && (s[i+1]!=','||s[i+1]!=';'))
				check = false;
			else if(s[i]<'0' || s[i]>'9')
				check = false;
		}
		//cout << st << ' ' << end << endl;
		if(st == end)
			vcb.pb(',');

		else if(check){
			for(int i = st; i < end; i++)
				vca.pb(s[i]);

			vca.pb(',');
		}

		else{
			for(int i = st; i < end; i++)
				vcb.pb(s[i]);

			vcb.pb(',');
		}

		st = end+1;
	}

	if(s[s.size()-1] == ',')
		vcb.pb(',');

	if(!vca.size())
		cout << '-' << endl;

	else{
		cout << '"';
		for(int i = 0; i < vca.size()-1; i++)
			cout << vca[i];
		cout << '"' << endl;
	}

	if(!vcb.size())
		cout << '-';

	else{
		cout << '"';
		for(int i = 0; i < vcb.size()-1; i++)
			cout << vcb[i];
		cout << '"';
	}

	return 0;
}


/*IN The Name of GOD*/
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

vector <char> vca, vcb;

bool mrk = true;

int main()
{
	string s;
	cin >> s;

	int st = 0;
	while(st <= s.size()){
		bool check = true;

		int end = s.size();
		for(int i = st; i <= s.size(); i++){
			if(s[i]==',' || s[i]==';' || i==s.size()){
				end = i;
				break;
			}

			if(i==st && s[i]=='0' && st!=s.size()-1 && s[i+1]!=',' && s[i+1]!=';')
				check = false;
			else if(s[i]<'0' || s[i]>'9')
				check = false;
		}
		//cout << st << ' ' << end << endl;
		if(st == end)
			vcb.pb(',');

		else if(check){
			for(int i = st; i < end; i++)
				vca.pb(s[i]);

			vca.pb(',');
		}

		else{
			for(int i = st; i < end; i++)
				vcb.pb(s[i]);

			vcb.pb(',');
		}

		st = end+1;
	}

	if(!vca.size())
		cout << '-' << endl;

	else{
		cout << '"';
		for(int i = 0; i < vca.size()-1; i++)
			cout << vca[i];
		cout << '"' << endl;
	}

	if(!vcb.size())
		cout << '-';

	else{
		cout << '"';
		for(int i = 0; i < vcb.size()-1; i++)
			cout << vcb[i];
		cout << '"';
	}

	return 0;
}


/*IN The Name of GOD*/
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

vector <char> vca, vcb;

bool mrk = true;

int main()
{
	string s;
	cin >> s;

	int st = 0;
	while(st <= s.size()){
		bool check = true;

		int end = s.size();
		for(int i = st; i <= s.size(); i++){
			if(s[i]==',' || s[i]==';' || i==s.size()){
				end = i;
				break;
			}

			if(i==st && s[i]=='0' && st!=s.size()-1 && s[i+1]!=',' && s[i+1]!=';'))
				check = false;
			else if(s[i]<'0' || s[i]>'9')
				check = false;
		}
		//cout << st << ' ' << end << endl;
		if(st == end)
			vcb.pb(',');

		else if(check){
			for(int i = st; i < end; i++)
				vca.pb(s[i]);

			vca.pb(',');
		}

		else{
			for(int i = st; i < end; i++)
				vcb.pb(s[i]);

			vcb.pb(',');
		}

		st = end+1;
	}

	if(!vca.size())
		cout << '-' << endl;

	else{
		cout << '"';
		for(int i = 0; i < vca.size()-1; i++)
			cout << vca[i];
		cout << '"' << endl;
	}

	if(!vcb.size())
		cout << '-';

	else{
		cout << '"';
		for(int i = 0; i < vcb.size()-1; i++)
			cout << vcb[i];
		cout << '"';
	}

	return 0;
}


/*   Remember,Whatever be the situation it's always under control.
     By Anup Kumar Tiwari,4th year Information Technology
     IIEST Shibpur
*/
#include<bits/stdc++.h>
#define ll long long
#define fli(a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define flj(b,n) for(ll j=(ll)b;j<(ll)n;j++)
#define rfl(n) for(ll i=(ll)(n-1);i>=0;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define ppb pop_back
#define MOD (ll)(1e9+7)
#define f first
#define s second
#define mp make_pair
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define Case(i) cout<<"Case #"<<i+1<<": ";
#define INF LLONG_MAX
#define NINF LLONG_MIN
#define ld long double
using namespace std;
bool any_char(string &c)
{
	if(c.size()==0)
		return 1;
	if(c.size()>1&&c[0]=='0')
		return 1;
	for(ll i=0;i<c.size();i++)
	{
		if((c[i]>='a'&&c[i]<='z')||(c[i]>='A'&&c[i]<='Z')||c[i]=='.')
			return 1;
	}
	return 0;
}
void solve()
{
	string str,a="",b="",c="";
	cin>>str;
	ll j=0;
	while(j<str.size())
	{
		if(str[j]==','||str[j]==';')
		{
			if(any_char(c))
			{
				c+=',';
				b+=c;
			}
			else
			{
				c+=',';
				a+=c;
			}
			c="";
		}
		else
			c+=str[j];
		j++;
	}
	if(c.size())
	{
		if(any_char(c))
		{
			c+=',';
			b+=c;
		}
		else
		{
			c+=',';
			a+=c;
		}
	}
	if(str.back()==',')
	{
		ll j=str.size()-2;
		while(j>=0&&str[j]!=','&&str[j]!=';')
		{
			if(str[j]>='A'&&str[j]<='Z'||(str[j]>='a'&&str[j]<='z')||str[j]=='.')
			{
				a.ppb();
				break;
			}
			j--;
		}
		if(j==-1)
			b.ppb();
	}
	else
	{
		if(a.size())
			a.ppb();
		if(b.size())
			b.ppb();
	}
	//cout<<a.size()<<" "<<b.size()<<endl;
	if(a.size())
		cout<<"\""<<a<<"\""<<endl;
	else
		cout<<'-'<<endl;
	if(b.size())
		cout<<"\""<<b<<"\""<<endl;
	else
		cout<<'-'<<endl;
}
int main(void)
{
	ios_base::sync_with_stdio(0);
	ll t=1;
	//cin>>t;
	for(ll i1=0;i1<t;i1++)
	{
		//Case(i1);
		solve();
	}
	return 0;
}


/*   Remember,Whatever be the situation it's always under control.
     By Anup Kumar Tiwari,4th year Information Technology
     IIEST Shibpur
*/
#include<bits/stdc++.h>
#define ll long long
#define fli(a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define flj(b,n) for(ll j=(ll)b;j<(ll)n;j++)
#define rfl(n) for(ll i=(ll)(n-1);i>=0;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define ppb pop_back
#define MOD (ll)(1e9+7)
#define f first
#define s second
#define mp make_pair
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define Case(i) cout<<"Case #"<<i+1<<": ";
#define INF LLONG_MAX
#define NINF LLONG_MIN
#define ld long double
using namespace std;
bool any_char(string &c)
{
	if(c.size()==0)
		return 1;
	if(c.size()>1&&c[0]=='0')
		return 1;
	for(ll i=0;i<c.size();i++)
	{
		if((c[i]>='a'&&c[i]<='z')||(c[i]>='A'&&c[i]<='Z')||c[i]=='.')
			return 1;
	}
	return 0;
}
void solve()
{
	string str,a="",b="",c="";
	ll k=-1;
	cin>>str;
	ll j=0;
	while(j<str.size())
	{
		if(str[j]==','||str[j]==';')
		{
			if(any_char(c))
			{
				c+=',';
				b+=c;k=j;
			}
			else
			{
				c+=',';
				a+=c;k=j;
			}
			c="";
		}
		else
			c+=str[j];
		j++;
	}
	if(c.size())
	{
		if(any_char(c))
		{
			c+=',';
			b+=c;
		}
		else
		{
			c+=',';
			a+=c;
		}
	}
	//cout<<k<<endl;
	if(a.size())
		a.ppb();
	if(k+1!=str.size()&&b.size())
		b.ppb();
	//cout<<a.size()<<" "<<b.size()<<endl;
	if(a.size())
		cout<<"\""<<a<<"\""<<endl;
	else
		cout<<'-'<<endl;
	if(b.size()||k!=-1)
		cout<<"\""<<b<<"\""<<endl;
	else
		cout<<'-'<<endl;
}
int main(void)
{
	ios_base::sync_with_stdio(0);
	ll t=1;
	//cin>>t;
	for(ll i1=0;i1<t;i1++)
	{
		//Case(i1);
		solve();
	}
	return 0;
}


/*   Remember,Whatever be the situation it's always under control.
     By Anup Kumar Tiwari,4th year Information Technology
     IIEST Shibpur
*/
#include<bits/stdc++.h>
#define ll long long
#define fli(a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define flj(b,n) for(ll j=(ll)b;j<(ll)n;j++)
#define rfl(n) for(ll i=(ll)(n-1);i>=0;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define ppb pop_back
#define MOD (ll)(1e9+7)
#define f first
#define s second
#define mp make_pair
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define Case(i) cout<<"Case #"<<i+1<<": ";
#define INF LLONG_MAX
#define NINF LLONG_MIN
#define ld long double
using namespace std;
bool any_char(string &c)
{
	if(c.size()==0)
		return 1;
	if(c.size()>1&&c[0]=='0')
		return 1;
	for(ll i=0;i<c.size();i++)
	{
		if((c[i]>='a'&&c[i]<='z')||(c[i]>='A'&&c[i]<='Z')||c[i]=='.')
			return 1;
	}
	return 0;
}
void solve()
{
	string str,a="",b="",c="";
	ll k=-1;
	cin>>str;
	ll j=0;
	while(j<str.size())
	{
		if(str[j]==','||str[j]==';')
		{
			if(any_char(c))
			{
				c+=',';
				b+=c;k=j;
			}
			else
			{
				c+=',';
				a+=c;k=j;
			}
			c="";
		}
		else
			c+=str[j];
		j++;
	}
	if(c.size())
	{
		if(any_char(c))
		{
			c+=',';
			b+=c;
		}
		else
		{
			c+=',';
			a+=c;
		}
	}
	//cout<<k<<endl;
	if(a.size())
		a.ppb();
	if(k+1!=str.size()&&b.size())
		b.ppb();
	//cout<<a.size()<<" "<<b.size()<<endl;
	if(a.size())
		cout<<"\""<<a<<"\""<<endl;
	else
		cout<<'-'<<endl;
	if(b.size())
		cout<<"\""<<b<<"\""<<endl;
	else
		cout<<'-'<<endl;
}
int main(void)
{
	ios_base::sync_with_stdio(0);
	ll t=1;
	//cin>>t;
	for(ll i1=0;i1<t;i1++)
	{
		//Case(i1);
		solve();
	}
	return 0;
}


/*   Remember,Whatever be the situation it's always under control.
     By Anup Kumar Tiwari,4th year Information Technology
     IIEST Shibpur
*/
#include<bits/stdc++.h>
#define ll long long
#define fli(a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define flj(b,n) for(ll j=(ll)b;j<(ll)n;j++)
#define rfl(n) for(ll i=(ll)(n-1);i>=0;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define ppb pop_back
#define MOD (ll)(1e9+7)
#define f first
#define s second
#define mp make_pair
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define Case(i) cout<<"Case #"<<i+1<<": ";
#define INF LLONG_MAX
#define NINF LLONG_MIN
#define ld long double
using namespace std;
bool any_char(string &c)
{
	if(c.size()==0)
		return 1;
	if(c.size()>1&&c[0]=='0')
		return 1;
	for(ll i=0;i<c.size();i++)
	{
		if((c[i]>='a'&&c[i]<='z')||(c[i]>='A'&&c[i]<='Z')||c[i]=='.')
			return 1;
	}
	return 0;
}
void solve()
{
	string str,a="",b="",c="";
	cin>>str;
	ll j=0;
	while(j<str.size())
	{
		if(str[j]==','||str[j]==';')
		{
			if(any_char(c))
			{
				c+=',';
				b+=c;
			}
			else
			{
				c+=',';
				a+=c;
			}
			c="";
		}
		else
			c+=str[j];
		j++;
	}
	if(c.size())
	{
		if(any_char(c))
		{
			c+=',';
			b+=c;
		}
		else
		{
			c+=',';
			a+=c;
		}
	}
	if(str.back()==',')
	{
		ll j=str.size()-2;
		while(j>=0&&str[j]!=','&&str[j]!=';')
		{
			if(str[j]>='A'&&str[j]<='Z'||(str[j]>='a'&&str[j]<='z')||str[j]=='.')
			{
				a.ppb();
				break;
			}
			j--;
		}
		if(j==-1)
			b.ppb();
	}
	else
	{
		if(a.size())
			a.ppb();
		if(b.size())
			b.ppb();
	}
	cout<<a.size()<<" "<<b.size()<<endl;
	if(a.size())
		cout<<"\""<<a<<"\""<<endl;
	else
		cout<<'-'<<endl;
	if(b.size())
		cout<<"\""<<b<<"\""<<endl;
	else
		cout<<'-'<<endl;
}
int main(void)
{
	ios_base::sync_with_stdio(0);
	ll t=1;
	//cin>>t;
	for(ll i1=0;i1<t;i1++)
	{
		//Case(i1);
		solve();
	}
	return 0;
}