#include <cstdio> #include <iostream> #include <vector> #include <queue> #include <algorithm> #include <functional> #define Maxn 100 #define Maxnum 99999999 using namespace std; int n, f[Maxn][Maxn], g[Maxn][Maxn], s, t; int path[Maxn], pre[Maxn], pathlen; bool vis[Maxn]; void init() { scanf("%d", &n); scanf("%d%d", &s, &t); for (int i=0; i<n; i++) for (int j=0; j<n; j++) scanf("%d", &g[i][j]); } void get_path(int a, int b) { if (a == b) path[pathlen] = a; else if (pre[b] != -1) { path[pathlen++] = b; get_path(a, pre[b]); } return; } int Edmonds_karp() { int maxf = 0, minc; bool flag; memset(f, 0, sizeof(f)); while (true) { queue<int> q; q.push(s); memset(path, 0, sizeof(path)); memset(pre, -1, sizeof(pre)); memset(vis, false, sizeof(vis)); vis[s] = true; flag = false; while (!q.empty()) { int now = q.front(); q.pop(); for (int j=0; j<n; j++) if (g[now][j] != f[now][j] && !vis[j]) { q.push(j); vis[j] = true; pre[j] = now; if (j == t) { flag = true; break; } } if (flag) break; } if (flag) { pathlen = 0; minc = Maxnum; get_path(s, t); for (int i = pathlen; i > 0; i--) minc <?= g[path[i]][path[i-1]] - f[path[i]][path[i-1]]; for (int i = pathlen; i > 0; i--) { f[path[i]][path[i-1]] += minc; f[path[i-1]][path[i]] = -f[path[i]][path[i-1]]; } } else { for (int i = 0; i < n; i++) maxf += f[s][i]; break; } } return maxf; } int main() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); init(); int ans = Edmonds_karp(); printf("%d/n", ans); return 0; }