#include using namespace std; long long c[5][5]; long long vis[1<<25]; long long ret = 1LL<<50; void solve(int mask, long long sum) { if (vis[mask]) return; vis[mask] = true; ret = min(ret, abs(sum)); if (sum > 0) { if (!mask) { for (int i = 0; i < 25; i++) solve(mask | 1<> c[i][j]; sum += c[i][j]; } } solve(0, sum); cout << ret << endl; return 0; }