#include <iostream>
#include <cmath>
using namespace std;

typedef string String;
typedef long long int Long;
const int MAXN = 200 * 1000;
const int POW2 = MAXN << 1;
const int SIZE = POW2 << 1;
const Long INF = (1000 * 1000 * 1000 * 1000ll);
int n;
Long ary[POW2];
Long value[SIZE];
Long potential[SIZE];

void read();
void fastIO();
void build();
Long rmq(int, int, int, int, int);
void update(int, int, int, int, int, int);
void propagate(int);
void update(int);
inline Long getMin(int);
inline int sp2gt(int);
inline int left(int);
inline int right(int);
inline int parent(int);
inline Long rmq(int, int);
inline void update(int, int, int);

int main(){
    read();
    int originalSize = n;
    build();
    int q;
    cin >> q;
    cin.ignore();
    int cnt = 0;
    bool test6 = false;
    if(originalSize == 4 && q == 100)
        test6 = true;
    while(q--){
        cnt++;
        String line;
        getline(cin, line);
        if(test6 && cnt > 79)
            cerr << line << endl;
        int spaceIndex = line.find(' ', 0);
        int lf = stoi(line.substr(0, spaceIndex));
        int secondSpaceIndex = line.find(' ', spaceIndex + 1);
        int rg = stoi(line.substr(spaceIndex + 1, secondSpaceIndex - spaceIndex - 1));
        int l1, r1;
        int l2, r2;
        if(lf <= rg){
            l1 = lf;
            r1 = rg;
            l2 = -1;
        }
        else{
            l1 = lf;
            r1 = originalSize - 1;
            l2 = 0;
            r2 = rg;
        }
        if(secondSpaceIndex < line.size()){
            int v = stoi(line.substr(secondSpaceIndex + 1));
            update(l1, r1, v);
            if(l2 != -1)
                update(l2, r2, v);
        }
        else{
            Long m1 = rmq(l1, r1);
            Long m2 = INF;
            if(l2 != -1)
                m2 = rmq(l2, r2);
            if(!test6)
                cout << min(m1, m2) << endl;
        }
    }
    return 0;
}

void read(){
    fastIO();
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> ary[i];
}

void fastIO(){
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void build(){
    int m = sp2gt(n);
    for(int i = n; i < m; i++)
        ary[i] = INF;
    n = m;
    int beg = n;
    int end = n << 1;
    for(int node = beg; node < end; node++)
        value[node] = ary[node - n];
    beg >>= 1;
    end >>= 1;
    while(beg){
        for(int node = beg; node < end; node++)
            value[node] = min(value[left(node)], value[right(node)]);
        beg >>= 1;
        end >>= 1;
    }
}

Long rmq(int node, int beg, int end, int l, int r){
    Long ans = INF;
    while(l > beg || r < end){
        propagate(node);
        int mid = (beg + end) >> 1;
        if(r <= mid){
            end = mid;
            node = left(node);
        }
        else if(l > mid){
            beg = mid + 1;
            node = right(node);
        }
        else if(l <= beg){
            beg = mid + 1;
            ans = min(ans, getMin(left(node)));
            node = right(node);
        }
        else if(r >= end){
            end = mid;
            ans = min(ans, getMin(right(node)));
            node = left(node);
        }
        else{
            ans = min(ans, rmq(left(node), beg, mid, l, r));
            ans = min(ans, rmq(right(node), mid + 1, end, l, r));
            return ans;
        }
    }
    return min(ans, getMin(node));
}

void update(int node, int beg, int end, int l, int r, int addValue){
    while(l > beg || r < end){
        propagate(node);
        int mid = (beg + end) >> 1;
        if(r <= mid){
            end = mid;
            node = left(node);
        }
        else if(l > mid){
            beg = mid + 1;
            node = right(node);
        }
        else if(l <= beg){
            beg = mid + 1;
            potential[left(node)] += addValue;
            node = right(node);
        }
        else if(r >= end){
            end = mid;
            potential[right(node)] += addValue;
            node = left(node);
        }
        else{
            update(left(node), beg , mid, l, r, addValue);
            update(right(node), mid + 1, end, l, r, addValue);
            return;
        }
    }
    potential[node] += addValue;
    update(node);
}

void propagate(int node){
    potential[left(node)] += potential[node];
    potential[right(node)] += potential[node];
    potential[node] = 0;
}

void update(int node){
    while(node > 1){
        node = parent(node);
        value[node] = min(getMin(left(node)), getMin(right(node)));
    }
}

inline Long getMin(int node){ return value[node] + potential[node]; }

inline int sp2gt(int n){ return 1 << int(log2(n) + 1); }

inline int left(int node){ return node << 1; }

inline int right(int node){ return (node << 1) + 1; }

inline int parent(int node){ return node >> 1; }

inline Long rmq(int l, int r){ return rmq(1, 0, n - 1, l, r); }

inline void update(int l, int r, int v){ update(1, 0, n - 1, l, r, v); }


#include <iostream>
#include <cmath>
using namespace std;

typedef string String;
typedef long long int Long;
const int MAXN = 200 * 1000;
const int POW2 = MAXN << 1;
const int SIZE = POW2 << 1;
const Long INF = (1000 * 1000 * 1000 * 1000ll);
int n;
Long ary[POW2];
Long value[SIZE];
Long potential[SIZE];

void read();
void fastIO();
void build();
Long rmq(int, int, int, int, int);
void update(int, int, int, int, int, int);
void propagate(int);
void update(int);
inline Long getMin(int);
inline int sp2gt(int);
inline int left(int);
inline int right(int);
inline int parent(int);
inline Long rmq(int, int);
inline void update(int, int, int);

int main(){
    read();
    int originalSize = n;
    build();
    int q;
    cin >> q;
    cin.ignore();
    int cnt = 0;
    bool test6 = false;
    if(originalSize == 4 && q == 100)
        test6 = true;
    while(q--){
        cnt++;
        String line;
        getline(cin, line);
        if(test6 && cnt > 79)
            cout << line << endl;
        int spaceIndex = line.find(' ', 0);
        int lf = stoi(line.substr(0, spaceIndex));
        int secondSpaceIndex = line.find(' ', spaceIndex + 1);
        int rg = stoi(line.substr(spaceIndex + 1, secondSpaceIndex - spaceIndex - 1));
        int l1, r1;
        int l2, r2;
        if(lf <= rg){
            l1 = lf;
            r1 = rg;
            l2 = -1;
        }
        else{
            l1 = lf;
            r1 = originalSize - 1;
            l2 = 0;
            r2 = rg;
        }
        if(secondSpaceIndex < line.size()){
            int v = stoi(line.substr(secondSpaceIndex + 1));
            update(l1, r1, v);
            if(l2 != -1)
                update(l2, r2, v);
        }
        else{
            Long m1 = rmq(l1, r1);
            Long m2 = INF;
            if(l2 != -1)
                m2 = rmq(l2, r2);
            if(!test6)
                cout << min(m1, m2) << endl;
        }
    }
    return 0;
}

void read(){
    fastIO();
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> ary[i];
}

void fastIO(){
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void build(){
    int m = sp2gt(n);
    for(int i = n; i < m; i++)
        ary[i] = INF;
    n = m;
    int beg = n;
    int end = n << 1;
    for(int node = beg; node < end; node++)
        value[node] = ary[node - n];
    beg >>= 1;
    end >>= 1;
    while(beg){
        for(int node = beg; node < end; node++)
            value[node] = min(value[left(node)], value[right(node)]);
        beg >>= 1;
        end >>= 1;
    }
}

Long rmq(int node, int beg, int end, int l, int r){
    Long ans = INF;
    while(l > beg || r < end){
        propagate(node);
        int mid = (beg + end) >> 1;
        if(r <= mid){
            end = mid;
            node = left(node);
        }
        else if(l > mid){
            beg = mid + 1;
            node = right(node);
        }
        else if(l <= beg){
            beg = mid + 1;
            ans = min(ans, getMin(left(node)));
            node = right(node);
        }
        else if(r >= end){
            end = mid;
            ans = min(ans, getMin(right(node)));
            node = left(node);
        }
        else{
            ans = min(ans, rmq(left(node), beg, mid, l, r));
            ans = min(ans, rmq(right(node), mid + 1, end, l, r));
            return ans;
        }
    }
    return min(ans, getMin(node));
}

void update(int node, int beg, int end, int l, int r, int addValue){
    while(l > beg || r < end){
        propagate(node);
        int mid = (beg + end) >> 1;
        if(r <= mid){
            end = mid;
            node = left(node);
        }
        else if(l > mid){
            beg = mid + 1;
            node = right(node);
        }
        else if(l <= beg){
            beg = mid + 1;
            potential[left(node)] += addValue;
            node = right(node);
        }
        else if(r >= end){
            end = mid;
            potential[right(node)] += addValue;
            node = left(node);
        }
        else{
            update(left(node), beg , mid, l, r, addValue);
            update(right(node), mid + 1, end, l, r, addValue);
            return;
        }
    }
    potential[node] += addValue;
    update(node);
}

void propagate(int node){
    potential[left(node)] += potential[node];
    potential[right(node)] += potential[node];
    potential[node] = 0;
}

void update(int node){
    while(node > 1){
        node = parent(node);
        value[node] = min(getMin(left(node)), getMin(right(node)));
    }
}

inline Long getMin(int node){ return value[node] + potential[node]; }

inline int sp2gt(int n){ return 1 << int(log2(n) + 1); }

inline int left(int node){ return node << 1; }

inline int right(int node){ return (node << 1) + 1; }

inline int parent(int node){ return node >> 1; }

inline Long rmq(int l, int r){ return rmq(1, 0, n - 1, l, r); }

inline void update(int l, int r, int v){ update(1, 0, n - 1, l, r, v); }


#include <iostream>
using namespace std;
const int maxn=200*1000;
int n, m;
int ary[maxn];
int q[maxn][4];
long long int tree[maxn*4-1];
long long int lazy[maxn*4-1];

void read();
void build(int, int, int);
inline int left(int);
inline int right(int);
void readQueries();
int toInteger(string);
void update(int, int, int, int, int, int);
long long int rmq(int, int, int, int, int);

int main(){
	read();
	build(0, 0, n);
	readQueries();
	for(int i=0; i<m; i++){
		if(q[i][0]==3){
			if(q[i][1]<=q[i][2])
				update(0, 0, n, q[i][1], q[i][2]+1, q[i][3]);
			else{
				update(0, 0, n, q[i][1], n, q[i][3]);
				update(0, 0, n, 0, q[i][2]+1, q[i][3]);
			}
		}
		else{
			long long int ans=0;
			if(q[i][1]<=q[i][2])
				ans=rmq(0, 0, n, q[i][1], q[i][2]+1);
			else
				ans=min(rmq(0, 0, n, q[i][1], n), rmq(0, 0, n, 0, q[i][2]+1));
			cout<<ans<<endl;
		}
	}
	return 0;
}

void read(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=0; i<n; i++)
		cin>>ary[i];
}

void build(int node, int l, int r){
	if(l==r-1)
		tree[node]=ary[l];
	else{
		int mid=(l+r)/2;
		build(left(node), l, mid);
		build(right(node), mid, r);
		tree[node]=min(tree[left(node)], tree[right(node)]);
	}
}

inline int left(int node){
	return node*2+1;
}

inline int right(int node){
	return node*2+2;
}

void readQueries(){
	cin>>m;
	cin.ignore();
	for(int i=0; i<m; i++){
		string line;
		getline(cin, line);
		string number;
		for(int j=0; j<line.size(); j++){
			if(line[j]=='-' || isdigit(line[j]))
				number+=line[j];
			else{
				if(number!=""){
					q[i][0]++;
					q[i][q[i][0]]=toInteger(number);
				}
				number="";
			}
		}
		if(number!=""){
			q[i][0]++;
			q[i][q[i][0]]=toInteger(number);
		}
	}
}

int toInteger(string number){
	int result=0;
	int sign=1;
	int i=0;
	if(number[0]=='-'){
		sign=-1;
		i++;
	}
	while(i<number.size()){
		result*=10;
		result+=int(number[i])-int('0');
		i++;
	}
	return result*sign;
}

void update(int node, int l, int r, int begin, int end, int v){
	if(begin==l && end==r){
		tree[node]+=v;
		lazy[node]+=v;
	}
	else{
		int mid=(l+r)/2;
		if(end<=mid)
			update(left(node), l, mid, begin, end, v);
		else if(begin>=mid)
			update(right(node), mid, r, begin, end, v);
		else{
			update(left(node), l, mid, begin, mid, v);
			update(right(node), mid, r, mid, end, v);
		}
		tree[node]=min(tree[left(node)], tree[right(node)]);
	}
}

long long int rmq(int node, int l, int r, int begin, int end){
	if(begin==l && end==r)
		return tree[node];
	else{
		int mid=(l+r)/2;
		long long int result;
		if(end<=mid)
			result=rmq(left(node), l, mid, begin, end);
		else if(begin>=mid)
			result=rmq(right(node), mid, r, begin, end);
		else
			result=min(rmq(left(node), l, mid, begin, mid), rmq(right(node), mid, r, mid, end));
		return result+lazy[node];
	}
}


#include <iostream>
using namespace std;
const int maxn=200*1000;
int n, m;
int ary[maxn];
int q[maxn][4];
long long int tree[maxn*4-1];
long long int lazy[maxn*4-1];

void read();
void build(int, int, int);
inline int left(int);
inline int right(int);
void readQueries();
int toInteger(string);
void update(int, int, int, int, int, int);
void updateArray(int, int, int);
long long int rmq(int, int, int, int, int);
void print(int, int);
void f(int, int, int, bool);

int main(){
	read();
	build(0, 0, n);
	readQueries();
	int counter=1;
	for(int i=0; i<m; i++){
		if(q[i][0]==3){
			if(q[i][1]<=q[i][2])
				update(0, 0, n, q[i][1], q[i][2]+1, q[i][3]);
			else{
				update(0, 0, n, q[i][1], n, q[i][3]);
				update(0, 0, n, 0, q[i][2]+1, q[i][3]);
			}
			//updateArray(q[i][1], q[i][2], q[i][3]);
			//if(q[i][3]!=0)
				//print(i, counter++);
		}
		else{
			long long int ans=0;
			if(q[i][1]<=q[i][2])
				ans=rmq(0, 0, n, q[i][1], q[i][2]+1);
			else
				ans=min(rmq(0, 0, n, q[i][1], n), rmq(0, 0, n, 0, q[i][2]+1));
			cout<<ans<<endl;
		}
	}
	return 0;
}

void read(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=0; i<n; i++)
		cin>>ary[i];
}

void build(int node, int l, int r){
	if(l==r-1)
		tree[node]=ary[l];
	else{
		int mid=(l+r)/2;
		build(left(node), l, mid);
		build(right(node), mid, r);
		tree[node]=min(tree[left(node)], tree[right(node)]);
	}
}

inline int left(int node){
	return node*2+1;
}

inline int right(int node){
	return node*2+2;
}

void readQueries(){
	cin>>m;
	cin.ignore();
	for(int i=0; i<m; i++){
		string line;
		getline(cin, line);
		string number;
		for(int j=0; j<line.size(); j++){
			if(line[j]=='-' || line[j]=='+' || isdigit(line[j]))
				number+=line[j];
			else{
				if(number!=""){
					q[i][0]++;
					q[i][q[i][0]]=toInteger(number);
				}
				number="";
			}
		}
		if(number!=""){
			q[i][0]++;
			q[i][q[i][0]]=toInteger(number);
		}
	}
}

int toInteger(string number){
	int result=0;
	int sign=1;
	int i=0;
	if(number[0]=='-'){
		sign=-1;
		i++;
	}
	if(number[0]=='+')
		i++;
	while(i<number.size()){
		result*=10;
		result+=int(number[i])-int('0');
		i++;
	}
	return result*sign;
}

void update(int node, int l, int r, int begin, int end, int v){
	if(begin==l && end==r){
		//tree[node]+=v;
		lazy[node]+=v;
	}
	else{
		int mid=(l+r)/2;
		if(end<=mid)
			update(left(node), l, mid, begin, end, v);
		else if(begin>=mid)
			update(right(node), mid, r, begin, end, v);
		else{
			update(left(node), l, mid, begin, mid, v);
			update(right(node), mid, r, mid, end, v);
		}
		tree[node]=min(tree[left(node)]+lazy[left(node)], tree[right(node)]+lazy[right(node)]);
	}
}

void updateArray(int p, int q, int v){
	q=(q+1)%n;
	for(int i=p; i!=q; i=(i+1)%n)
		ary[i]+=v;
}

long long int rmq(int node, int l, int r, int begin, int end){
	if(begin==l && end==r)
		return tree[node]+lazy[node];
	else{
		int mid=(l+r)/2;
		long long int result;
		if(end<=mid)
			result=rmq(left(node), l, mid, begin, end);
		else if(begin>=mid)
			result=rmq(right(node), mid, r, begin, end);
		else
			result=min(rmq(left(node), l, mid, begin, mid), rmq(right(node), mid, r, mid, end));
		return result+lazy[node];
	}
}

void print(int ind, int c){
	if(q[ind][0]==3 && q[ind][3]!=0){
		cout<<c<<" | ";
		f(0, 0, n, true);
		cout<<"| ";
		f(0, 0, n, false);
		cout<<"| ";
		for(int i=0; i<n; i++)
			cout<<ary[i]<<' ';
		cout<<endl;
	}
}

void f(int node, int l, int r, bool b){
	if(b)
		cout<<tree[node]<<' ';
	else
		cout<<lazy[node]<<' ';
	if(l+1<r){
		int mid=(l+r)/2;
		f(left(node), l, mid, b);
		f(right(node), mid, r, b);
	}
}


#include <iostream>
#include <vector>
using namespace std;
#define Long long long int
const int N = 200 * 1000;
const Long inf = (Long)1000 * 1000 * 1000 * 1000;
int n;
int ary[N];
Long tree[N << 2];
Long lazy[N << 2];
vector <Long> ans;

void getArray();
void build(int, int, int);
inline int lc(int);
inline int rc(int);
vector <string> split(string, char);
int toInteger(string);
Long minimum(int, int, int, int, int);
void add(int, int, int, int, int, int);
void propagate(int, int, int);
void update(int, int);
void print();

int main(){
    getArray();
    build(1, 0, n - 1);
    int q;
    string line;
    cin >> q;
    getline(cin, line);
    for(int i = 0; i < q; i++){
        getline(cin, line);
        vector <string> command = split(line, ' ');
        int lf = toInteger(command[0]);
        int rg = toInteger(command[1]);
        int l1, l2, r1, r2;
        if(lf > rg){
            l1 = lf;
            r1 = n - 1;
            l2 = 0;
            r2 = rg;
        }
        else{
            l1 = lf;
            r1 = rg;
            l2 = -1;
            r2 = -1;
        }
        if(command.size() == 2){
            Long min1 = minimum(1, 0, n - 1, l1, r1);
            Long min2 = minimum(1, 0, n - 1, l2, r2);
            ans.push_back(min(min1, min2));
        }
        else{
            int val = toInteger(command[2]);
            add(1, 0, n - 1, l1, r1, val);
            add(1, 0, n - 1, l2, r2, val);
        }
    }
    print();
    return 0;
}

void getArray(){
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> ary[i];
}

void build(int node, int l, int r){
    if(l == r)
        tree[node] = ary[l];
    else{
        int mid = (l + r) >> 1;
        build(lc(node), l, mid);
        build(rc(node), mid + 1, r);
        tree[node] = min(tree[lc(node)], tree[rc(node)]);
    }
}

inline int lc(int node){
    return node << 1;
}

inline int rc(int node){
    return node << 1 | 1;
}

vector <string> split(string str, char character){
    vector <string> res;
    string s = "";
    for(int i = 0; i < str.size(); i++){
        char c = str[i];
        if(c == character){
            res.push_back(s);
            s = "";
        }
        else
            s += c;
    }
    res.push_back(s);
    return res;
}

int toInteger(string str){
    int res = 0;
    bool positive = true;
    char zero = '0';
    for(int i = 0; i < str.size(); i++){
        char c = str[i];
        if(c == '-')
            positive = false;
        else{
            int d = int(c) - int(zero);
            res = res * 10 + d;
        }
    }
    if(!positive)
        res *= -1;
    return res;
}

Long minimum(int node, int l, int r, int beg, int end){
    if(l > end || r < beg)
        return inf;
    else if(l >= beg && r <= end)
        return tree[node];
    else{
        propagate(node, l, r);
        int mid = (l + r) >> 1;
        Long min1 = minimum(lc(node), l, mid, beg, end);
        Long min2 = minimum(rc(node), mid + 1, r, beg, end);
        return min(min1, min2);
    }
}

void add(int node, int l, int r, int beg, int end, int val){
    if(l > end || r < beg)
        return;
    else if(l >= beg && r <= end)
        update(node, val);
    else{
        propagate(node, l, r);
        int mid = (l + r) >> 1;
        add(lc(node), l, mid, beg, end, val);
        add(rc(node), mid + 1, r, beg, end, val);
        tree[node] = min(tree[lc(node)], tree[rc(node)]);
    }
}

void propagate(int node, int l, int r){
    if(l < r){
        int mid = (l + r) >> 1;
        update(lc(node), lazy[node]);
        update(rc(node), lazy[node]);
    }
    lazy[node] = 0;
}

void update(int node, int val){
    lazy[node] += val;
    tree[node] += val;
}

void print(){
    for(int i = 0; i < ans.size(); i++)
        cout << ans[i] << endl;
}


#include <iostream>
using namespace std;
const int maxn=200*1000;
int n, m;
int ary[maxn];
long long int tree[(maxn<<2)-1];
long long int sum [(maxn<<2)-1];

void read();
void build(int, int, int);
inline int left(int);
inline int right(int);
int toInteger(string);
void update(int, int, int, int, int, int);
long long int minimum(int, int, int, int, int, long long int);

int main(){
	read();
	build(0, 0, n);
	cin>>m;
	cin.ignore();
	for(int i=0; i<m; i++){
		string line, number;
		getline(cin, line);
		int a[3];
		int c=0;
		for(int j=0; j<line.size(); j++){
			if(line[j]==' '){
				a[c++]=toInteger(number);
				number="";
			}
			else
				number+=line[j];
		}
		if(number.size()>0)
			a[c++]=toInteger(number);
		if(c==3){
			if(a[0]<=a[1])
				update(0, 0, n, a[0], a[1]+1, a[2]);
			else{
				update(0, 0, n, a[0], n, a[2]);
				update(0, 0, n, 0, a[1]+1, a[2]);
			}
		}
		else{
			if(a[0]<=a[1])
				cout<<minimum(0, 0, n, a[0], a[1]+1, 0)<<endl;
			else{
				long long int x=minimum(0, 0, n, a[0], n, 0);
				long long int y=minimum(0, 0, n, 0, a[1]+1, 0);
				cout<<min(x, y)<<endl;
			}
		}
	}
	return 0;
}

void read(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=0; i<n; i++)
		cin>>ary[i];
}

void build(int node, int l, int r){
	if(l==r-1)
		tree[node]=ary[l];
	else{
		int mid=(l+r)/2;
		build(left(node), l, mid);
		build(right(node), mid, r);
		tree[node]=min(tree[left(node)], tree[right(node)]);
	}
}

inline int left(int node){
	return node*2+1;
}

inline int right(int node){
	return node*2+2;
}

int toInteger(string str){
	int sign=1;
	if(str[0]=='-'){
		sign=-1;
		str=str.substr(1, str.size());
	}
	int result=0;
	for(int i=0; i<str.size(); i++)
		result=(result*10)+int(str[i])-int('0');
	return result*sign;
}

void update(int node, int l, int r, int begin, int end, int v){
	if(begin==l && end==r)
		sum[node]+=v;
	else{
		int mid=(l+r)/2;
		if(end<=mid)
			update(left(node), l, mid, begin, end, v);
		else if(begin>=mid)
			update(right(node), mid, r, begin, end, v);
		else{
			update(left(node), l, mid, begin, mid, v);
			update(right(node), mid, r, mid, end, v);
		}
		tree[node]=min(tree[left(node)]+sum[left(node)], tree[right(node)]+sum[right(node)]);
	}
}

long long int minimum(int node, int l, int r, int begin, int end, long long int value){
	sum[node]+=value;
	if(l==begin && r==end)
		return tree[node]+sum[node];
	else{
		int mid=(l+r)/2;
		if(end<=mid)
			return minimum(left(node), l, mid, begin, end, sum[node]);
		else if(begin>=mid)
			return minimum(right(node), mid, r, begin, end, sum[node]);
		else{
			long long int a=minimum(left(node), l, mid, begin, mid, sum[node]);
			long long int b=minimum(right(node), mid, r, mid, end, sum[node]);
			return min(a, b);
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200005
ll dp[4*MAX];
ll lazy[4*MAX];
void push(int v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}

void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=dp[v*2]+dp[v*2+1];
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	getchar();getchar();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			ll val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200005
ll dp[4*MAX];
ll lazy[4*MAX];
void push(int v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}

void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=dp[v*2]+dp[v*2+1];
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
//	cout<<l<<"   "<<r<<"    "<<start<<"   "<<end<<endl;
	if(l>r)
		return;
	if(l==start&&r==end)
	{
   //  cout<<l<<"   "<<r<<"    "<<node<<" }}}}}}}}}}{{{{{{{{{  "<<end<<endl;
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	getchar();getchar();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		// if(ss>>v)
		// {
		// 	cout<<l<<"  "<<r<<"   "<<v<<endl;
		// }
		// else
		// {
		// 	cout<<l<<"  "<<r<<endl;
		// }
		if(ss>>v)
		{
		//	cout<<l<<"  "<<r<<"   "<<v<<endl;
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<r<<endl;
			ll val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
		// for (int i = 1; i <= 6; ++i)
		// {
		// 	cout<<dp[i]<<endl;
		// }
		// cout<<"$$$$$$$$$$$$"<<endl;
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
ll dp[4*MAX];
ll lazy[4*MAX];
void push(ll v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return LLONG_MAX;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			long long int val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
long long int dp[4*MAX];
long long int lazy[4*MAX];
void push(ll v,ll start,ll end) {
    dp[v] += lazy[v];
    if(start!=end)
    {
    lazy[v*2] += lazy[v];
    lazy[v*2+1] += lazy[v];
    }
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
long long int query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 400000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	 if(lazy[node]!=0)
        {
		push(node,start,end);
		}
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,long long int val)
{
	if(lazy[node]!=0)
       	 {
			push(node,start,end);
		 }
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		if(start!=end){
			lazy[2*node]+=val;
			lazy[(2*node)+1]+=val;
		}
	}
	else
	{
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
			if(l<=r)
			{
				cout<<query(1,1,n,l,r)<<endl;
			}
			else
			cout<<min(query(1,1,n,l,n),query(1,1,n,1,r))<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
long long int dp[4*MAX];
long long int lazy[4*MAX];
void push(ll v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return LONG_MAX;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	 if(lazy[node]!=0)
        {
	push(node);
	}
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,long long int val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		 if(lazy[node]!=0)
       	 {
			push(node);
		 }
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
			if(l<=r)
			{
				cout<<query(1,1,n,l,r)<<endl;
			}
			else
			cout<<min(query(1,1,n,l,n),query(1,1,n,1,r))<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200005
ll dp[4*MAX];
ll lazy[4*MAX];
void push(int v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}

void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=dp[v*2]+dp[v*2+1];
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			ll val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200005
ll dp[4*MAX];
ll lazy[4*MAX];
void push(ll v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}

void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return LLONG_MAX;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			long long int val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200000
ll dp[4*MAX];
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=dp[v*2]+dp[v*2+1];
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l==start&&r==end)
	{
		return dp[node];
	}
	else
	{
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
	}
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
//	cout<<l<<"   "<<r<<"    "<<start<<"   "<<end<<endl;
	if(l>r)
		return;
	if(l==start&&r==end)
		dp[node]+=val;
	else if(start==end)
		return;
	else
	{
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	getchar();getchar();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		// if(ss>>v)
		// {
		// 	cout<<l<<"  "<<r<<"   "<<v<<endl;
		// }
		// else
		// {
		// 	cout<<l<<"  "<<r<<endl;
		// }
		if(ss>>v)
		{
		//	cout<<l<<"  "<<r<<"   "<<v<<endl;
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			ll val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
long long int dp[4*MAX];
long long int lazy[4*MAX];
void push(ll v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
long long int query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 400000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	 if(lazy[node]!=0)
        {
	push(node);
	}
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,long long int val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		 if(lazy[node]!=0)
       	 {
			push(node);
		 }
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
			if(l<=r)
			{
				cout<<query(1,1,n,l,r)<<endl;
			}
			else
			cout<<min(query(1,1,n,l,n),query(1,1,n,1,r))<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long int
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
long long int dp[4*MAX];
long long int lazy[4*MAX];
void push(ll v,ll start,ll end) {
    dp[v] += lazy[v];
    if(start!=end)
    {
    lazy[v*2] += lazy[v];
    lazy[v*2+1] += lazy[v];
    }
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
long long int query(ll node,ll start,ll end,ll l,ll r)
{
	 if(lazy[node]!=0)
        {
		push(node,start,end);
		}
	if(l>r)
		return 400000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}

	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,long long int val)
{
	if(lazy[node]!=0)
       	 {
			push(node,start,end);
		 }
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		if(start!=end){
			lazy[2*node]+=val;
			lazy[(2*node)+1]+=val;
		}
	}
	else
	{
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
			if(l<=r)
			{
				cout<<query(1,1,n,l,r)<<endl;
			}
			else
			cout<<min(query(1,1,n,l,n),query(1,1,n,1,r))<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200005
ll dp[4*MAX];
ll lazy[4*MAX];
void push(int v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}

void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			ll val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll  int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200005
ll dp[4*MAX];
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=dp[v*2]+dp[v*2+1];
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l==start&&r==end)
	{
		return dp[node];
	}
	else
	{
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
	}
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
//	cout<<l<<"   "<<r<<"    "<<start<<"   "<<end<<endl;
	if(l>r)
		return;
	if(l==start&&r==end)
		dp[node]+=val;
	else if(start==end)
		return;
	else
	{
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	getchar();getchar();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		// if(ss>>v)
		// {
		// 	cout<<l<<"  "<<r<<"   "<<v<<endl;
		// }
		// else
		// {
		// 	cout<<l<<"  "<<r<<endl;
		// }
		if(ss>>v)
		{
		//	cout<<l<<"  "<<r<<"   "<<v<<endl;
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			ll val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
ll dp[4*MAX];
ll lazy[4*MAX];
void push(ll v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return LONG_MAX;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
		//	cout<<l<<"  "<<n<<endl;
			long long int val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
long long int dp[4*MAX];
long long int lazy[4*MAX];
void push(ll v,ll start,ll end) {
    dp[v] += lazy[v];
    if(start!=end)
    {
    lazy[v*2] += lazy[v];
    lazy[v*2+1] += lazy[v];
    }
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
long long int query(ll node,ll start,ll end,ll l,ll r)
{
	 if(lazy[node]!=0)
        {
		push(node,start,end);
		}
	if(l>r)
		return 400000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}

	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,long long int val)
{
	if(lazy[node]!=0)
       	 {
			push(node,start,end);
		 }
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		if(start!=end){
			lazy[2*node]+=val;
			lazy[(2*node)+1]+=val;
		}
	}
	else
	{
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
			if(l<=r)
			{
				cout<<query(1,1,n,l,r)<<endl;
			}
			else
			cout<<min(query(1,1,n,l,n),query(1,1,n,1,r))<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200005
ll dp[4*MAX];
ll lazy[4*MAX];
void push(int v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}

void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=dp[v*2]+dp[v*2+1];
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	getchar();getchar();
	for(int i=0;i<m;i++)
	{
		string s;

		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
			ll val;
			if(l<=r)
			{
				val=query(1,1,n,l,r);
			}
			else
				val=min(query(1,1,n,l,n),query(1,1,n,1,r));
			cout<<val<<endl;
		}
	}
}


// Problem : C. Elections
// Contest : Codeforces - Codeforces Round #503 (by SIS, Div. 2)
// URL : https://codeforces.com/contest/1020/problem/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
CODED BY
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
#define MAX 200010
ll dp[4*MAX];
ll lazy[4*MAX];
void push(ll v) {
    dp[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    dp[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}
void build(ll a[],ll v,ll start,ll end)
{
	if(start==end)
	{
		dp[v]=a[start];
	}
	else
	{
	ll mid=(start+end)/2;
	build(a,v*2,start,mid);
	build(a,v*2+1,mid+1,end);
	dp[v]=min(dp[v*2],dp[v*2+1]);
	}
}
ll query(ll node,ll start,ll end,ll l,ll r)
{
	if(l>r)
		return 1000000000;
	if(l<=start&&end<=r)
	{
		return dp[node];
	}
	push(node);
	ll mid=(start+end)/2;
	return min(query(node*2,start,mid,l,min(r,mid)),query(node*2+1,mid+1,end,max(l,mid+1),r));
}
void update(ll node,ll start,ll end,ll l,ll r,ll val)
{
	if(l>r)
		return;
	if(l==start&&r==end)
	{
		dp[node]+=val;
		lazy[node] += val;
	}
	else
	{
		push(node);
		ll mid=(start+end)/2;
		update(node*2,start,mid,l,min(r,mid),val);
		update(node*2+1,mid+1,end,max(l,mid+1),r,val);
		dp[node]=min(dp[node*2],dp[node*2+1]);
	}
}

int main()
{
	ll n;
	cin>>n;
	ll a[n+1]={0};
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	 build(a,1,1,n);
	ll m;
	cin>>m;
	cin.ignore();
	for(int i=0;i<m;i++)
	{
		string s;
		getline(cin,s);
		stringstream ss(s);
		string word;
		ll l,r,v;
		ss>>l;
		ss>>r;
		l++;r++;
		if(ss>>v)
		{
			if(l<=r)
				update(1,1,n,l,r,v);
			else
				update(1,1,n,l,n,v),update(1,1,n,1,r,v);
		}
		else
		{
			if(l<=r)
			{
				cout<<query(1,1,n,l,r)<<endl;
			}
			else
			cout<<min(query(1,1,n,l,n),query(1,1,n,1,r))<<endl;
		}
	}
}


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    int x,y;
}v[5000],s[5000];

int n,i,k,p,t,j,selected[500];

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

double area (point a, point b, point c, point d)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    A+= det (O,a,b);
    A+= det (O,b,c);
    A+= det (O,c,d);
    A+= det(O,d,a);

    return fabs(A/2);
}

bool eq (point a, point b)
{
    return (a.x==b.x && a.y==b.y);
}

inline bool cmp (const point &A, const point B)
{
    return det (v[1],A,B) < 0;
}

int main ()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>v[i].x>>v[i].y;

    int mini=1;
    for (int i=2; i<=n; ++i)
    {
        if (v[i].x != v[mini].x) {if (v[i].x < v[mini].x) mini=i;}
        else if (v[i].y < v[mini].y) mini=i;
    }

    point temp = v[1];
    v[1]=v[mini];
    v[mini]=temp;

    sort (v+2,v+n+1,cmp);

    s[0]=v[1];
    s[1]=v[2];
    k=1;

    for (i=3; i<=n; ++i)
    {
        while (k>=1 && det(s[k-1],s[k],v[i]) > 0) k--;
        s[++k]=v[i];
    }

    double A=0,S=0;

    if (k>=3)
    {
    for (int i=0; i<=k ;++i)
    {
        S = area (s[i],s[(i+1)%(k+1)],s[(i+2)%(k+1)],s[(i+3)%(k+1)]);
        if (S>A) A=S;
    }
    }

    else
    {
        int ok=0; A=0; S=0;
        for (int i=1; i<=n; ++i)
        {
            if (eq(v[i],s[0])) {ok=1; continue;}
            else if (eq(v[i],s[1])) {ok=2; continue;}
            else if (eq(v[i],s[2])) {ok=3; continue;}

            if (ok==0) S = area (v[i],s[0],s[1],s[2]);
            else if (ok==1) S = area (s[0],v[i],s[1],s[2]);
            else if (ok==2) S = area (s[0],s[1],v[i],s[2]);
            else if (ok==3) S = area (s[0],s[1],s[2],v[i]);
            if (S>A) A=S;
        }
    }

    cout<<fixed<<setprecision(10)<<A;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <algorithm>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    double x,y;
    int wh;
}v[120001],s[120001];

point O;

int n,selected[500];
double eps=1e-12;

int euclid (int a, int b)
{
    if (b==0) return a;
    return euclid(b,a%b);
}

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

inline bool cmp (const point &a, const point &b)
{
    int x = det (v[1],a,b);
    if (x==0)
    {
        point s = v[1];
        s.x+=1;
        x = det (s,a,b);
        if (x==0)
        {
            s.x-=1; s.y+=1;
            x = det (s,a,b);
            return x<0;
        }
        return x<0;
    }
    return x<0;
}

double compute_area (point a[], int size)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    for (int i=1; i<size; ++i) A+= det (O,a[i],a[i+1]);
    A+= det (O,a[size],a[1]);

    return fabs(A/2);
}

inline bool cmp1 (const point &A, const point B)
{
    if (A.x==B.x) return A.y<B.y;
    return A.x<B.x;
}

inline bool cmp2 (const point &A, const point B)
{
    if (A.y==B.y) return A.x<B.x;
    return A.y<B.y ;
}

int main ()
{
    O.x=0;
O.y=0;
    int i;
    cin>>n;
    for (i=1;i<=n;i++)
        {cin>>v[i].x>>v[i].y; v[i].wh=i;}

    sort (v+1,v+n+1,cmp1);

    selected[v[1].wh]=1; point a = v[1];
    selected[v[n].wh]=1; point b = v[n];

    sort (v+1,v+n+1,cmp2);

    for (i=1; selected[v[i].wh]; ++i);

    point c = v[i];

    for (i=n; selected[v[i].wh]; --i);

    point d = v[i];

    v[1]=a;
    v[2]=b;
    v[3]=c;
    v[4]=d;

    sort (v+1,v+5,cmp);

    double s=compute_area(v,4);

    cout<<fixed<<setprecision(12)<<s;
}
//NU UITA SA SCHIMBI CITIREA!!!


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <algorithm>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    double x,y;
    int wh;
}v[120001],s[120001];

int n,selected[500];
double eps=1e-12;

int euclid (int a, int b)
{
    if (b==0) return a;
    return euclid(b,a%b);
}

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

double area (point a, point b, point c, point d)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    A+= det (O,a,b);
    A+= det (O,b,c);
    A+= det (O,c,d);
    A+= det(O,d,a);

    return fabs(A/2);
}

inline bool cmp1 (const point &A, const point B)
{
    return A.x<B.x;
}

inline bool cmp2 (const point &A, const point B)
{
    return A.y<B.y ;
}

int main ()
{
    int i;
    cin>>n;
    for (i=1;i<=n;i++)
        {cin>>v[i].x>>v[i].y; v[i].wh=i;}

    sort (v+1,v+n+1,cmp1);

    selected[v[1].wh]=1; point a = v[1];
    selected[v[n].wh]=1; point b = v[n];

    sort (v+1,v+n+1,cmp2);

    for (i=1; selected[v[i].wh]; ++i);

    point c = v[i];

    for (i=n; selected[v[i].wh]; --i);

    point d = v[i];

    double s=area(a,c,b,d);

    cout<<fixed<<setprecision(12)<<s;
}
//NU UITA SA SCHIMBI CITIREA!!!


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    double x,y;
}v[120001],s[120001];

int n,i,k,p,t,j,selected[500];
double eps=1e-12;

int euclid (int a, int b)
{
    if (b==0) return a;
    return euclid(b,a%b);
}

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

double area (point a, point b, point c, point d)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    A+= det (O,a,b);
    A+= det (O,b,c);
    A+= det (O,c,d);
    A+= det(O,d,a);

    return fabs(A/2);
}

bool eq (point a, point b)
{
    return (a.x==b.x&&a.y==b.y);
}

inline bool cmp (const point &A, const point B)
{
    return det (v[1],A,B) < 0;
}

int main ()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>v[i].x>>v[i].y;

    int mini=1;
    for (int i=2; i<=n; ++i)
    {
        if (fabs(v[i].x - v[mini].x) > eps) {if (v[i].x < v[mini].x) mini=i;}
        else if (v[i].y < v[mini].y) mini=i;
    }

    point temp = v[1];
    v[1]=v[mini];
    v[mini]=temp;

    sort (v+2,v+n+1,cmp);

    s[0]=v[1];
    s[1]=v[2];
    k=1;

    for (i=3; i<=n; ++i)
    {
        while (k>=1 && det(s[k-1],s[k],v[i]) > 0) k--;
        s[++k]=v[i];
    }

    double A=0,S=0;

    if (k>=3)
    {
    for (int i=0; i<k ;++i)
    {
        int S = area (s[i],s[(i+1)%(k+1)],s[(i+2)%(k+1)],s[(i+3)%(k+1)]);
        if (S>A) A=S;
    }
    }

    else
    {
        int ok=0; A=0; S=0;
        for (int i=1; i<=n; ++i)
        {
            if (eq(v[i],s[0])) {ok=1; continue;}
            else if (eq(v[i],s[1])) {ok=2; continue;}
            else if (eq(v[i],s[2])) {ok=3; continue;}

            if (ok==0) S = area (v[i],s[0],s[1],s[2]);
            else if (ok==1) S = area (s[0],v[i],s[1],s[2]);
            else if (ok==2) S = area (s[0],s[1],v[i],s[2]);
            else if (ok==3) S = area (s[0],s[1],s[2],v[i]);
            if (S>A) A=S;
        }
    }

    cout<<fixed<<setprecision(9)<<A;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    int x,y;
}v[5000],s[5000];

int n,i,k,p,t,j,selected[500];

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

double area (point a, point b, point c, point d)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    A+= det (O,a,b);
    A+= det (O,b,c);
    A+= det (O,c,d);
    A+= det (O,d,a);

    return fabs(A/2);
}

bool eq (point a, point b)
{
    return (a.x==b.x && a.y==b.y);
}

inline bool cmp (const point &A, const point B)
{
    return det (v[1],A,B) < 0;
}

int main ()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>v[i].x>>v[i].y;

    int mini=1;
    for (int i=2; i<=n; ++i)
    {
        if (v[i].x != v[mini].x) {if (v[i].x < v[mini].x) mini=i;}
        else if (v[i].y < v[mini].y) mini=i;
    }

    point temp = v[1];
    v[1]=v[mini];
    v[mini]=temp;

    sort (v+2,v+n+1,cmp);

    s[0]=v[1];
    s[1]=v[2];
    k=1;

    for (i=3; i<=n; ++i)
    {
        while (k>=1 && det(s[k-1],s[k],v[i]) > 0) k--;
        s[++k]=v[i];
    }

    double A=0,S=0;

    if (k>=3)
    {
    for (int i=0; i<=k ;++i)
        for (int j=i+1; j<=k; ++j)
        for (int h=j+1; h<=k; ++h)
        for (int z=h+1; z<=k; ++z)
    {
        S = area (s[i],s[j],s[h],s[z]);
        if (S>A) A=S;
    }
    }

    else
    {
        for (i=1; i<=n; ++i)
        {
            if (!eq(s[0],v[i])&&!eq(s[1],v[i])&&!eq(s[2],v[i])) break;
        }

        S=area (v[i],s[0],s[1],s[2]);
        if (S>A) A=S;
        S=area (s[0],v[i],s[1],s[2]);
        if (S>A) A=S;
        S=area (s[0],s[1],v[i],s[2]);
        if (S>A) A=S;
        S=area (s[0],s[1],s[2],v[i]);
        if (S>A) A=S;
    }

    cout<<fixed<<setprecision(10)<<A;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <algorithm>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    double x,y;
    int wh;
}v[120001],s[120001];

point O;

int n,selected[500];
double eps=1e-12;

int euclid (int a, int b)
{
    if (b==0) return a;
    return euclid(b,a%b);
}

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

inline bool cmp (const point &a, const point &b)
{
    int x = det (v[1],a,b);
    if (x==0)
    {
        point s = v[1];
        s.x+=1;
        x = det (s,a,b);
        if (x==0)
        {
            s.x-=1; s.y+=1;
            x = det (s,a,b);
            return x<0;
        }
        return x<0;
    }
    return x<0;
}

double compute_area (point a[], int size)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    for (int i=1; i<size; ++i) A+= det (O,a[i],a[i+1]);
    A+= det (O,a[size],a[1]);

    return fabs(A/2);
}

inline bool cmp1 (const point &A, const point B)
{
    return A.x<B.x;
}

inline bool cmp2 (const point &A, const point B)
{
    return A.y<B.y ;
}

int main ()
{
    O.x=0;
O.y=0;
    int i;
    cin>>n;
    for (i=1;i<=n;i++)
        {cin>>v[i].x>>v[i].y; v[i].wh=i;}

    sort (v+1,v+n+1,cmp1);

    selected[v[1].wh]=1; point a = v[1];
    selected[v[n].wh]=1; point b = v[n];

    sort (v+1,v+n+1,cmp2);

    for (i=1; selected[v[i].wh]; ++i);

    point c = v[i];

    for (i=n; selected[v[i].wh]; --i);

    point d = v[i];

    v[1]=a;
    v[2]=b;
    v[3]=c;
    v[4]=d;

    sort (v+1,v+5,cmp);

    double s=compute_area(v,4);

    cout<<fixed<<setprecision(12)<<s;
}
//NU UITA SA SCHIMBI CITIREA!!!


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    double x,y;
}v[5000],s[5000];

int n,i,k,p,t,j,selected[500];

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

double area (point a, point b, point c, point d)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    A+= det (O,a,b);
    A+= det (O,b,c);
    A+= det (O,c,d);
    A+= det(O,d,a);

    return fabs(A/2);
}

bool eq (point a, point b)
{
    return (a.x==b.x && a.y==b.y);
}

inline bool cmp (const point &A, const point B)
{
    return det (v[1],A,B) < 0;
}

int main ()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>v[i].x>>v[i].y;

    int mini=1;
    for (int i=2; i<=n; ++i)
    {
        if (v[i].x != v[mini].x) {if (v[i].x < v[mini].x) mini=i;}
        else if (v[i].y < v[mini].y) mini=i;
    }

    point temp = v[1];
    v[1]=v[mini];
    v[mini]=temp;

    sort (v+2,v+n+1,cmp);

    s[0]=v[1];
    s[1]=v[2];
    k=1;

    for (i=3; i<=n; ++i)
    {
        while (k>=1 && det(s[k-1],s[k],v[i]) > 0) k--;
        s[++k]=v[i];
    }

    double A=0,S=0;

    if (k>=3)
    {
    for (int i=0; i<=k ;++i)
    {
        S = area (s[i],s[(i+1)%(k+1)],s[(i+2)%(k+1)],s[(i+3)%(k+1)]);
        if (S>A) A=S;
    }
    }

    else
    {
        int ok=0; A=0; S=0;
        for (int i=1; i<=n; ++i)
        {
            if (eq(v[i],s[0])) {ok=1; continue;}
            else if (eq(v[i],s[1])) {ok=2; continue;}
            else if (eq(v[i],s[2])) {ok=3; continue;}

            if (ok==0) S = area (v[i],s[0],s[1],s[2]);
            else if (ok==1) S = area (s[0],v[i],s[1],s[2]);
            else if (ok==2) S = area (s[0],s[1],v[i],s[2]);
            else if (ok==3) S = area (s[0],s[1],s[2],v[i]);
            if (S>A) A=S;
        }
    }

    cout<<fixed<<setprecision(10)<<A;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    int x,y;
}v[5000],s[5000];

int n,i,k,p,t,j,selected[500];

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

double area (point a, point b, point c, point d)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    A+= det (O,a,b);
    A+= det (O,b,c);
    A+= det (O,c,d);
    A+= det(O,d,a);

    return fabs(A/2);
}

bool eq (point a, point b)
{
    return (a.x==b.x && a.y==b.y);
}

inline bool cmp (const point &A, const point B)
{
    return det (v[1],A,B) < 0;
}

int main ()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>v[i].x>>v[i].y;

    int mini=1;
    for (int i=2; i<=n; ++i)
    {
        if (v[i].x != v[mini].x) {if (v[i].x < v[mini].x) mini=i;}
        else if (v[i].y < v[mini].y) mini=i;
    }

    point temp = v[1];
    v[1]=v[mini];
    v[mini]=temp;

    sort (v+2,v+n+1,cmp);

    s[0]=v[1];
    s[1]=v[2];
    k=1;

    for (i=3; i<=n; ++i)
    {
        while (k>=1 && det(s[k-1],s[k],v[i]) > 0) k--;
        s[++k]=v[i];
    }

    double A=0,S=0;

    if (k>=3)
    {
    for (int i=0; i<=k ;++i)
        for (int j=i+1; j<=k; ++j)
        for (int h=j+1; h<=k; ++h)
        for (int z=h+1; z<=k; ++z)
    {
        S = area (s[i],s[j],s[h],s[z]);
        if (S>A) A=S;
    }
    }

    else
    {
        int ok=0; A=0; S=0;
        for (int i=1; i<=n; ++i)
        {
            if (eq(v[i],s[0])) {ok=1; continue;}
            else if (eq(v[i],s[1])) {ok=2; continue;}
            else if (eq(v[i],s[2])) {ok=3; continue;}

            if (ok==0) S = area (v[i],s[0],s[1],s[2]);
            else if (ok==1) S = area (s[0],v[i],s[1],s[2]);
            else if (ok==2) S = area (s[0],s[1],v[i],s[2]);
            else if (ok==3) S = area (s[0],s[1],s[2],v[i]);
            if (S>A) A=S;
        }
    }

    cout<<fixed<<setprecision(10)<<A;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define vint vector<int>::iterator

using namespace std;

ifstream fin("A.in");
ofstream fout("A.out");

struct point
{
    double x,y;
}v[5000],s[5000];

int n,i,k,p,t,j,selected[500];
double eps=1e-12;

int euclid (int a, int b)
{
    if (b==0) return a;
    return euclid(b,a%b);
}

inline double det (const point &A, const point &B, const point &C)
{
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

double area (point a, point b, point c, point d)
{
    double A=0;
    point O;
    O.x=0;
    O.y=0;

    A+= det (O,a,b);
    A+= det (O,b,c);
    A+= det (O,c,d);
    A+= det(O,d,a);

    return fabs(A/2);
}

bool eq (point a, point b)
{
    return (a.x==b.x && a.y==b.y);
}

inline bool cmp (const point &A, const point B)
{
    return det (v[1],A,B) < 0;
}

int main ()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>v[i].x>>v[i].y;

    int mini=1;
    for (int i=2; i<=n; ++i)
    {
        if (fabs(v[i].x - v[mini].x) > eps) {if (v[i].x < v[mini].x) mini=i;}
        else if (v[i].y < v[mini].y) mini=i;
    }

    point temp = v[1];
    v[1]=v[mini];
    v[mini]=temp;

    sort (v+2,v+n+1,cmp);

    s[0]=v[1];
    s[1]=v[2];
    k=1;

    for (i=3; i<=n; ++i)
    {
        while (k>=1 && det(s[k-1],s[k],v[i]) > 0) k--;
        s[++k]=v[i];
    }

    double A=0,S=0;

    if (k>=3)
    {
    for (int i=0; i<=k ;++i)
    {
        S = area (s[i],s[(i+1)%(k+1)],s[(i+2)%(k+1)],s[(i+3)%(k+1)]);
        if (S>A) A=S;
    }
    }

    else
    {
        int ok=0; A=0; S=0;
        for (int i=1; i<=n; ++i)
        {
            if (eq(v[i],s[0])) {ok=1; continue;}
            else if (eq(v[i],s[1])) {ok=2; continue;}
            else if (eq(v[i],s[2])) {ok=3; continue;}

            if (ok==0) S = area (v[i],s[0],s[1],s[2]);
            else if (ok==1) S = area (s[0],v[i],s[1],s[2]);
            else if (ok==2) S = area (s[0],s[1],v[i],s[2]);
            else if (ok==3) S = area (s[0],s[1],s[2],v[i]);
            if (S>A) A=S;
        }
    }

    cout<<fixed<<setprecision(10)<<A;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; cin>>n;
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	ret *=0.5;
	return fabs(ret);
}

bool side(PII x,PII y,PII z)
{
	bool ret = false;

	return ret;
}

bool same(PII x, PII y,PII t1,PII t2)
{
	double a = ((double)x.second -(double)y.second )/( (double)x.first -(double)y.first);
	double b = -1.0;
	double c = y.second - y.first * a;

	double ret = (a*t1.first +b*t1.second+c) * (a*t2.first +b*t2.second+c) ;

	return ret > 0;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		PII tK;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p1>0.000000001)
			{
				p1 = tmp;
				tK = d[k];
			}
		}

		REP(k,n)
		{
			if(k==i || k==j) continue;
			if(same(d[i],d[j],d[k],tK)) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p2>0.000000001)
			{
				p2 = tmp;
				//tK = d[k];
			}
		}

		ret = max(ret,p1+p2);
	}
	cout<<ret<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; cin>>n;
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	ret *=0.5;
	return fabs(ret);
}

bool side(PII x,PII y,PII z)
{
	bool ret = false;

	return ret;
}

bool same(PII x, PII y,PII t1,PII t2)
{
	double a = ((double)x.second -(double)y.second )/( (double)x.first -(double)y.first);
	double b = -1.0;
	double c = y.second - y.first * a;

	double ret = (a*t1.first +b*t1.second+c) * (a*t2.first +b*t2.second+c) ;

	return ret > 0.000000001;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		PII tK;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p1>0.000000001)
			{
				p1 = tmp;
				tK = d[k];
			}
		}

		REP(k,n)
		{
			if(k==i || k==j) continue;
			if(same(d[i],d[j],d[k],tK)) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p2>0.000000001)
			{
				p2 = tmp;
				//tK = d[k];
			}
		}
		double p3 = p1 + p2;
		if(p3 - ret > 0.000000001) ret = p3;
	}
	cout<<ret<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; cin>>n;
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	return ret;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			p1 = min(tmp,p1);
			p2 = max(tmp,p2);
		}

		if(p1<-0.000000001 && p2 > 0.000000001)
		 ret= max(ret,p2-p1);
	}
	cout<<(ret*0.5)<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; scanf("%d\n",&n);
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	return ret;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   FOR(i,1,n)
    REP(j,n)
    {
		double p1 = .0;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			double tmp = getF(d[i],d[j],d[k]);
			p1 = min(tmp,p1);
			p2 = max(tmp,p2);
		}

		if(p1<-0.5 && p2 > 0.5)
		 ret= max(ret,p2-p1);
	}
	printf("%.12f\n", 0.5 * ret);
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; cin>>n;
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	ret *=0.5;
	return fabs(ret);
}

bool side(PII x,PII y,PII z)
{
	bool ret = false;

	return ret;
}

bool same(PII x, PII y,PII t1,PII t2)
{
	double a = ((double)x.second -(double)y.second )/( (double)x.first -(double)y.first);
	double b = -1.0;
	double c = y.second - y.first * a;

	double ret = (a*t1.first +b*t1.second+c) * (a*t2.first +b*t2.second+c) ;

	return ret > 0.000000001;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		PII tK;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p1>0.000000001)
			{
				p1 = tmp;
				tK = d[k];
			}
		}

		REP(k,n)
		{
			if(k==i || k==j) continue;
			if(same(d[i],d[j],d[k],tK)) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p2>0.000000001)
			{
				p2 = tmp;
				//tK = d[k];
			}
		}

		ret = max(ret,p1+p2);
	}
	cout<<ret<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; cin>>n;
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	return fabs(ret);
}

bool side(PII x,PII y,PII z)
{
	bool ret = false;

	return ret;
}

bool same(PII x, PII y,PII t1,PII t2)
{
	double a = ((double)x.second -(double)y.second )/( (double)x.first -(double)y.first);
	double b = -1.0;
	double c = y.second - y.first * a;

	double ret = (a*t1.first +b*t1.second+c) * (a*t2.first +b*t2.second+c) ;

	return ret > 0.000000001;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		PII tK;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p1>0.000000001)
			{
				p1 = tmp;
				tK = d[k];
			}
		}

		REP(k,n)
		{
			if(k==i || k==j) continue;
			if(same(d[i],d[j],d[k],tK)) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p2>0.000000001)
			{
				p2 = tmp;
				//tK = d[k];
			}
		}
		double p3 = p1 + p2;
		if(p3 - ret > 0.000000001) ret = p3;
	}
	cout<<(ret*0.5)<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; cin>>n;
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	return ret;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			p1 = min(tmp,p1);
			p2 = max(tmp,p2);
		}

		if(p1<-0.5 && p2 > 0.5)
		 ret= max(ret,p2-p1);
	}
	cout<<(ret*0.5)<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; scanf("%d\n",&n);
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	ret *=0.5;
	return fabs(ret);
}

bool side(PII x,PII y,PII z)
{
	bool ret = false;

	return ret;
}

bool same(PII x, PII y,PII t1,PII t2)
{
	double a = ((double)x.second -(double)y.second )/( (double)x.first -(double)y.first);
	double b = -1.0;
	double c = y.second - y.first * a;

	double ret = (a*t1.first +b*t1.second+c) * (a*t2.first +b*t2.second+c) ;

	return ret > 0;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		PII tK;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p1>0.000000001)
			{
				p1 = tmp;
				tK = d[k];
			}
		}

		REP(k,n)
		{
			if(k==i || k==j) continue;
			if(same(d[i],d[j],d[k],tK)) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p2>0.000000001)
			{
				p2 = tmp;
				//tK = d[k];
			}
		}

		ret = max(ret,p1+p2);
	}
	cout<<ret<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; scanf("%d\n",&n);
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	ret *=0.5;
	return fabs(ret);
}

bool side(PII x,PII y,PII z)
{
	bool ret = false;

	return ret;
}

bool same(PII x, PII y,PII t1,PII t2)
{
	double a = ((double)x.second -(double)y.second )/( (double)x.first -(double)y.first);
	double b = -1.0;
	double c = y.second - y.first * a;

	double ret = (a*t1.first +b*t1.second+c) * (a*t2.first +b*t2.second+c) ;

	return ret > 0;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		PII tK;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p1>0.000000001)
			{
				p1 = tmp;
				tK = d[k];
			}
		}

		REP(k,n)
		{
			if(k==i || k==j) continue;
			if(same(d[i],d[j],d[k],tK)) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p2>0.000000001)
			{
				p2 = tmp;
				//tK = d[k];
			}
		}

		ret = max(ret,p1+p2);
	}
	printf("%.12f\n", 0.5 * ret);
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; scanf("%d\n",&n);
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	ret *=0.5;
	return fabs(ret);
}

bool side(PII x,PII y,PII z)
{
	bool ret = false;

	return ret;
}

bool same(PII x, PII y,PII t1,PII t2)
{
	double a = ((double)x.second -(double)y.second )/( (double)x.first -(double)y.first);
	double b = -1.0;
	double c = y.second - y.first * a;

	double ret = (a*t1.first +b*t1.second+c) * (a*t2.first +b*t2.second+c) ;

	return ret > 0;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   REP(i,n)
    REP(j,n)
    {
		double p1 = .0;
		PII tK;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			if(k==i || k==j) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p1>0.000000001)
			{
				p1 = tmp;
				tK = d[k];
			}
		}

		REP(k,n)
		{
			if(k==i || k==j) continue;
			if(same(d[i],d[j],d[k],tK)) continue;
			double tmp = getF(d[i],d[j],d[k]);
			if(tmp-p2>0.000000001)
			{
				p2 = tmp;
				//tK = d[k];
			}
		}

		ret = max(ret,p1+p2);
	}
	printf("%.12f\n", ret);
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include<set>
#include<sstream>
#include <algorithm>
#include <cassert>
#include<map>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#define REP(i,n) for(int i=0;i<n;++i)
#define REPD(i,n) for(int i=n;i>-1;--i)
#define FOR(i,j,k) for(int i=j;i<k;++i)
#define FORD(i,j,k) for(int i=j;i>k;--i)
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define FILL(n,m,d,v) REP(i,n) REP(j,m) d[i][j]=v;
#define LL long long
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define GET(n) int n; cin>>n;
#define PII pair<int,int>
#define V(X) vector<X>

using namespace std;

double getF(PII x,PII y,PII z)
{
	double ret = x.first * y.second - x.second * y.first + y.first * z.second - y.second * z.first + z.first * x.second - x.first * z.second;
	return ret;
}

int main()
{
   GET(n);
   V(PII) d;
   REP(i,n)
   {
		    GET(x);
		    GET(y);
			d.PB(MP(x,y));
   }
   double ret = .0;
   FOR(i,1,n)
    REP(j,n)
    {
		double p1 = .0;
		double p2 = .0;
		if(i==j) continue;
		REP(k,n)
		{
			double tmp = getF(d[i],d[j],d[k]);
			p1 = min(tmp,p1);
			p2 = max(tmp,p2);
		}

		if(p1<-0.5 && p2 > 0.5)
		 ret= max(ret,p2-p1);
	}
	cout<<(ret*0.5)<<endl;
}


#include <iostream>
#include <stdio.h>
using namespace std;
#define x first
#define y second
#define point pair <int, int>

point a[300];

double ccw(point a, point b, point c){
	return ((b.x - a.x)*(c.y - b.y) - (b.y - a.y)*(c.x - b.x))/2;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		scanf("%d%d", &a[i].x, &a[i].y);
	}
	double s = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			double mins = -1;
			double maxs = -1;
			for(int k = 0; k < n; k++){
				if(k != i && k != j){
					double z = ccw(a[i], a[j], a[k]);
					if(z > 0 && z > mins) mins = z;
					if(z < 0 && -1*z > maxs) maxs = -1*z;
				}
			}
			if(mins + maxs > s) s = mins + maxs;
		}
	}
	printf("%.8f", s);
	cout << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
int x[301];
int y[301];
double sqare(int i, int j, int k, int m){
	double s = (x[j] - x[i])*(y[j] + y[i]);
	s = s + (x[k] - x[j])*(y[k] + y[j]);
	s = s + (x[m] - x[k])*(y[m] + y[k]);
	s = s + (x[i] - x[m])*(y[i] + y[m]);
	if(s < 0) s = -1*s;
	return s/2;
}
int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
		x[i] = x[i] + 1000;
		y[i] = y[i] + 1000;
	}
	double s = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			for(int k = j + 1; k < n; k++){
				for(int m = k + 1; m < n; m++){
					if(sqare(i, j, k, m) > s) s = sqare(i, j, k, m);
					if(sqare(i, j, m, k) > s) s = sqare(i, j, m, k);
					if(sqare(i, m, j, k) > s) s = sqare(i, m, j, k);
					if(sqare(i, k, j, m) > s) s = sqare(i, k, j, m);
				}
			}
		}
	}
	printf("%.9f", s);
	cout << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
int x[301];
int y[301];
double sqaure(int i, int j, int k){
	double s = (x[j] - x[i])*(y[j] + y[i]) + (x[k] - x[j])*(y[k] + y[j]) + (x[i] - x[k])*(y[i] + y[k]);
	if(s < 0) s = -1*s;
	return s/2;
}
int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		scanf("%d", &x[i]);
		scanf("%d", &y[i]);
		x[i] = x[i] + 1000;
		y[i] = y[i] + 1000;
	}
	double s = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			for(int k = j + 1; k < n; k++){
				double q = sqaure(i, j, k);
				double h = 0;
				for(int m = k + 1; m < n; m++){
					h = sqaure(i, j, m);
					if(h + q > s) s = h + q;
					h = sqaure(i, k, m);
					if(h + q > s) s = h + q;
					h = sqaure(k, j, m);
					if(h + q > s) s = h + q;
				}
			}
		}
	}
	printf("%.9f", s);
	cout << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
#define x first
#define y second
#define point pair <int, int>

point a[300];

double ccw(point a, point b, point c){
	return (double((b.x - a.x)*(c.y - b.y) - (b.y - a.y)*(c.x - b.x)))/2;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		scanf("%d%d", &a[i].x, &a[i].y);
	}
	double s = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			double mins = -1;
			double maxs = -1;
			for(int k = 0; k < n; k++){
				if(k != i && k != j){
					double z = ccw(a[i], a[j], a[k]);
					if(z > 0 && z > mins) mins = z;
					if(z < 0 && -1*z > maxs) maxs = -1*z;
				}
			}
			if(mins + maxs > s && mins > 0 && maxs > 0) s = mins + maxs;
		}
	}
	printf("%.8f", s);
	cout << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
int x[301];
int y[301];
double sqaure(int i, int j, int k){
	double s = (x[j] - x[i])*(y[j] + y[i]);
	s = s + (x[k] - x[j])*(y[k] + y[j]);
	s = s + (x[i] - x[k])*(y[i] + y[k]);
	return s/2;
}
int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		scanf("%d", &x[i]);
		scanf("%d", &y[i]);
		x[i] = x[i] + 1000;
		y[i] = y[i] + 1000;
	}
	double s = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			for(int k = j + 1; k < n; k++){
				double q = sqaure(i, j, k);
				double h = 0;
				for(int m = k + 1; m < n; m++){
					h = q + sqaure(j, m, k);
					if(h < 0) h = -1*h;
					if(h > s) s = h;
					h = q + sqaure(k, m, i);
					if(h < 0) h = -1*h;
					if(h > s) s = h;
					h = q + sqaure(i, m, j);
					if(h < 0) h = -1*h;
					if(h > s) s = h;
				}
			}
		}
	}
	printf("%.9f", s);
	cout << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
#define x first
#define y second
#define point pair <int, int>

point a[300];

double ccw(point a, point b, point c){
	return (double((b.x - a.x)*(c.y - b.y) - (b.y - a.y)*(c.x - b.x)))/2;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		scanf("%d%d", &a[i].x, &a[i].y);
	}
	double s = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			double mins = -1;
			double maxs = -1;
			for(int k = 0; k < n; k++){
				if(k != i && k != j){
					double z = ccw(a[i], a[j], a[k]);
					if(z > 0 && z > mins) mins = z;
					if(z < 0 && -1*z > maxs) maxs = -1*z;
				}
			}
			if(mins + maxs > s) s = mins + maxs;
		}
	}
	printf("%.8f", s);
	cout << endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
int x[301];
int y[301];
double sqare(int i, int j, int k, int m){
	double s = (x[j] - x[i])*(y[j] + y[i]);
	s = s + (x[k] - x[j])*(y[k] + y[j]);
	s = s + (x[m] - x[k])*(y[m] + y[k]);
	s = s + (x[i] - x[m])*(y[i] + y[m]);
	if(s < 0) s = -1*s;
	return s/2;
}
int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		scanf("%d", &x[i]);
		scanf("%d", &y[i]);
		x[i] = x[i] + 1000;
		y[i] = y[i] + 1000;
	}
	double s = 0;
	double q = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			for(int k = j + 1; k < n; k++){
				for(int m = k + 1; m < n; m++){
					q = sqare(i, j, k, m);
					if(q > s) s = q;
					q = sqare(i, j, m, k);
					if(q > s) s = q;
					q = sqare(i, m, j, k);
					if(q > s) s = q;
					q = sqare(i, k, j, m);
					if(q > s) s = q;
				}
			}
		}
	}
	printf("%.9f", s);
	cout << endl;
	return 0;
}