#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

template<int... Sizes>
struct MultidimensionalIndex;
template<>
struct MultidimensionalIndex<> {
	MultidimensionalIndex() {}
	int getTotalSize() const { return 1; }
	int getIndexAcc(int acc) const { return acc; }
};
template<int Head, int... Tail>
struct MultidimensionalIndex<Head, Tail...> : MultidimensionalIndex<Tail...> {
	using Base = MultidimensionalIndex<Tail...>;
	enum { size = Head };
	template<typename... TailT>
	MultidimensionalIndex(TailT... tail) : Base(tail...) {}
	int getTotalSize() const { return size * Base::getTotalSize(); }
	template<typename... TailT>
	int getIndexAcc(int acc, int head, TailT... tail) const { return Base::getIndexAcc(acc * size + head, tail...); }
};
template<int... Tail>
struct MultidimensionalIndex<0, Tail...> : MultidimensionalIndex<Tail...> {
	using Base = MultidimensionalIndex<Tail...>;
	const int size;
	template<typename... TailT>
	MultidimensionalIndex(int head, TailT... tail) : size(head), MultidimensionalIndex<Tail...>(tail...) {}
	int getTotalSize() const { return size * Base::getTotalSize(); }
	template<typename... TailT>
	int getIndexAcc(int acc, int head, TailT... tail) const { return Base::getIndexAcc(acc * size + head, tail...); }
};

template<typename Val, int... Sizes>
struct DP : MultidimensionalIndex<Sizes...> {
	using Base = MultidimensionalIndex<Sizes...>;
	std::vector<Val> dp;
	template<typename... SizesT>
	DP(Val init, SizesT... sizes) : Base(sizes...), dp(Base::getTotalSize(), init) {}
	template<typename... SizesT>
	Val &operator()(SizesT... indices) { return dp[Base::getIndexAcc(0, indices...)]; }
	template<typename... SizesT>
	Val operator()(SizesT... indices) const { return dp[Base::getIndexAcc(0, indices...)]; }
	void swap(DP &that) { dp.swap(that); }
};

struct Interval {
	int L, R, X;
	bool operator<(const Interval &that) const {
		return X < that.X;
	}
};

int main() {
	int N;
	while(~scanf("%d", &N)) {
		vector<Interval> intervals(N);
		rep(i, N) {
			int L; int R;
			scanf("%d%d", &L, &R);
			intervals[i] = { L, R, L + R };
		}
		sort(intervals.begin(), intervals.end());
		reverse(intervals.begin(), intervals.end());
		DP<ll, 0, 0, 2> dp(INFL, N / 2 + 2, N / 2 + 2);
		dp(0, 0, 0) = 0;
		rep(i, N) {
			const Interval a = intervals[i];
			rer(l, 0, min(i, N / 2)) rep(c, 2) {
				int r = i - l - c;
				if(r < 0 || r > N / 2) continue;
				ll x = dp(l, r, c);
				if(x == INFL) continue;
				amin(dp(l + 1, r, c), x + a.R + (ll)a.X * l);
				amin(dp(l, r + 1, c), x + a.L + (ll)a.X * r);
				if(c == 0)
					amin(dp(l, r, c + 1), x + (ll)a.X * (N / 2));
			}
		}
		ll ans = dp(N / 2, N / 2, N % 2);
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 98176