#include <bits/stdc++.h>
using namespace std;
const int maxn = 2550;
using ll = long long;
using pll = pair<ll, ll>;
void amin(ll &a, ll b){
	a = min(a, b);
}
ll f[2][maxn][maxn];
int main(){
	vector<pll> e;
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		ll a, b; cin >> a >> b;
		e.push_back({a, b});
	}
	sort(e.begin(), e.end(), [](pll a, pll b){
		return a.first + a.second > b.first + b.second;
	});
	int m = n / 2;
	const ll inf = 1ll<<60;
	for(int i = 0; i < 2; i++) 
		for(int j = 0; j <= m; j++) 
			for(int k = 0; k <= m; k++) 
				f[i][j][k] = inf;
	f[0][0][0] = 0;
	for(int i = 0; i < n; i++){
		ll a, b; tie(a, b) = e[i];
		ll l = a + b;
		int ati = min(i, m);
		for(int x = 0; x < 2; x++){
			for(int y = 0; y + x <= ati; y++){
				int z = i - y - x;
				amin(f[x][y+1][z], f[x][y][z] + b + y * l);
				amin(f[x][y][z+1], f[x][y][z] + a + z * l);
				if(!x){
					amin(f[1][y][z], f[x][y][z] + m * l);
				}
			}
		}
	}
	cout << f[n&1][m][m] << endl;
	return 0;
}
