1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
template<class T, class U>
ostream& operator<<(ostream& os, pair<T, U> p) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template<class C, class = typename C::value_type>
typename enable_if<!is_same<C, string>::value, ostream&>::type
operator<<(ostream& os, C c) {
    for (auto i = c.begin(); i != c.end(); i++) {
        os << " {"[i == c.begin()] << *i << ",}"[next(i) == c.end()];
    }
    return os;
}

#define debug(x) { cerr << #x << " = " << x << endl; }
#else
#define debug(...) {}
#endif

#define st first
#define nd second

typedef long long int lli;
typedef long double lf;

typedef pair<lf, lf> pkt;
typedef pair<pkt, pkt> tower;
typedef pair<pkt, pkt> lin;

const lf EPS = 1e-10;

vector<tower> v;
vector<pkt> P;
vector<lin> bound;

pkt operator+(pkt a, const pkt &b) {
	a.st += b.st;
	a.nd += b.nd;
	return a;
}

pkt operator-(pkt a, const pkt &b) {
	a.st -= b.st;
	a.nd -= b.nd;
	return a;
}

pkt operator*(pkt a, lf b) {
	a.st *= b;
	a.nd *= b;
	return a;
}

pkt scan() {
	lf x, y;
	scanf("%Lf%Lf", &x, &y);
	return {x, y};
}

bool eq(lf a, lf b) {
	return abs(a-b) < EPS;
}

bool eq(const pkt &a, const pkt &b) {
	return eq(a.st, b.st) && eq(a.nd, b.nd);
}

lf ilv(const pkt &a, const pkt &b) {
	return a.st*b.nd-a.nd*b.st;
}

lf ilv(const pkt &a, const pkt &b, const pkt &cent) {
	return ilv(a-cent, b-cent);
}

lf ils(const pkt &a, const pkt &b) {
	return a.st*b.st+a.nd*b.nd;
}

lf ils(const pkt &a, const pkt &b, const pkt &cent) {
	return ils(a-cent, b-cent);
}

void check(const pkt &a, const pkt &b, vector<lin> &out) {
	if (eq(a, b))
		return;
	
	int nump = 0, numn = 0;
	
	for (const auto &t : v) {
		auto il1 = ilv(t.st, b, a);
		auto il2 = ilv(t.nd, b, a);
		
		if (eq(il1, 0) || eq(il2, 0))
			continue;
		
		if (il1 > 0 && il2 > 0)
			nump++;
		
		if (il1 < 0 && il2 < 0)
			numn++;
	}
	
	if (numn > 0)
		return;
	
	out.push_back({a, b});
}

bool cmp_lin_ilv(const lin &a, const lin &b) {
	assert(eq(a.st, b.st));
	return ilv(a.nd, b.nd, a.st) > 0;
}

bool cmp_pkt_ilv(const pkt &a, const pkt &b) {
	return ilv(a, b) > 0;
}

int answer(lf res) {
	printf("%.18Lf\n", abs(res));
	return 0;
}

pkt inter(const lin &p, const lin &q) {
	
	lf a = p.nd.st-p.st.st;
	lf b = q.st.st-q.nd.st;
	lf c = q.st.st-p.st.st;
	
	lf d = p.nd.nd-p.st.nd;
	lf e = q.st.nd-q.nd.nd;
	lf f = q.st.nd-p.st.nd;
	
	lf bet = (a*f-c*d)/(a*e-b*d);
	
	return q.st+((q.nd-q.st)*bet);
}

void push_ok(const lin &p, const lin &q, vector<pkt> &out) {
	if (eq(ilv(p.st-p.nd, q.st-q.nd), 0))
		return;
	
	auto a = inter(p, q);
	
	for (const auto &l : bound) {
		lf il = ilv(a, l.nd, l.st);
		
		if (eq(il, 0))
			continue;
		
		if (il < 0)
			return;
	}
	
	out.push_back(a);
}

int main() {
	int n;
	scanf("%d", &n);
	
	for (int i=0; i<n; i++) {
		v.push_back({scan(), scan()});
		P.push_back(v.back().st);
		P.push_back(v.back().nd);
	}
	
	for (const auto &p1 : P) {
		vector<lin> bd;
		for (const auto &p2 : P) {
			check(p1, p2, bd);
		}
		
		if (bd.empty())
			continue;
		
		sort(bd.begin(), bd.end(), cmp_lin_ilv);
		
// 		debug(p1);
// 		debug(bd);
		
		int nump = 0, numn = 0;
		
		for (const auto &l : bd) {
			auto il = ilv(l.nd, bd[0].nd, l.st);
			if (eq(il, 0))
				continue;
			if (il > 0)
				nump++;
			else
				numn++;
		}
		
		if (nump > 0 && numn > 0)
			return answer(0);
		
		bound.push_back(bd[0]);
	}
	
// 	for (auto l : bound) {
// 		printf("(%.1lf, %.1lf) (%.1lf, %.1lf)\n", l.st.st, l.st.nd, l.nd.st, l.nd.nd);
// 	}
	
	vector<pkt> vrt;
	
	for (int i=0; i<(int)bound.size(); i++) {
		for (int j=0; j<i; j++) {
			push_ok(bound[i], bound[j], vrt);
		}
	}
	
// 	debug(vrt);
	
	if (vrt.empty())
		return answer(0);
	
	pkt cent = vrt.back();
	vrt.pop_back();
	
	for (int i=0; i<(int)vrt.size(); i++) {
		if (eq(vrt[i], cent)) {
			swap(vrt[i], vrt.back());
			vrt.pop_back();
			i--;
		}
	}
	
	for (int i=0; i<(int)vrt.size(); i++) {
		vrt[i] = vrt[i]-cent;
	}
	
	sort(vrt.begin(), vrt.end(), cmp_pkt_ilv);
	
// 	debug(cent);
// 	debug(vrt);
	
	lf res = 0;
	
	for (int i=0; i<(int)vrt.size()-1; i++) {
		res += ilv(vrt[i], vrt[i+1]);
	}
	
	res /= 2;
	
	answer(res);
	
	return 0;
}