#include #define For(i, a, b) for(long long i = a; i < b; i++) #define rep(i, n) For(i, 0, n) #define rFor(i, a, b) for(long long i = a; i >= b; i--) #define ALL(v) (v).begin(), (v).end() #define rALL(v) (v).rbegin(), (v).rend() using namespace std; using lint = long long; using ld = long double; struct bint { vector num; bool plus; bint() {} bint(string s, bool plus_) : num(s.size()), plus(plus_) { for (int i = 0; i < (int)s.size(); i++) { num[i] = s[(int)s.size() - i - 1] - '0'; } } }; vector carry_and_fix(vector a) { int n = a.size(); for (int i = 0; i < n - 1; i++) { if (a[i] >= 10) { int k = a[i] / 10; a[i] -= k * 10; a[i + 1] += k; } if (a[i] < 0) { int k = (-a[i] - 1) / 10 + 1; a[i] += k * 10; a[i + 1] -= k; } } while (a.back() >= 10) { int k = a.back() / 10; a.back() -= k * 10; a.emplace_back(k); } while (a.size() >= 2 && a.back() == 0) { a.pop_back(); } return a; } vector addition(vector a, vector b) { int sa = a.size(), sb = b.size(); int n = max(sa, sb); vector res(n); for (int i = 0; i < n; i++) { res[i] = (i < sa ? a[i] : 0) + (i < sb ? b[i] : 0); } return carry_and_fix(res); } vector subtraction(vector a, vector b) { int sa = a.size(), sb = b.size(); int n = max(sa, sb); vector res(n); for (int i = 0; i < n; i++) { res[i] = (i < sa ? a[i] : 0) - (i < sb ? b[i] : 0); } return carry_and_fix(res); } bool large_or_equal(vector a, vector b) { int sa = a.size(), sb = b.size(); if (sa != sb) { return (sa > sb ? true : false); } for (int i = sa - 1; i >= 0; i--) { if (a[i] != b[i]) { return (a[i] > b[i] ? true : false); } } return true; } bint operator+(bint a, bint b) { bint res; if (a.plus && b.plus) { res.num = addition(a.num, b.num); res.plus = true; } else if (a.plus && !b.plus) { if (large_or_equal(a.num, b.num)) { res.num = subtraction(a.num, b.num); res.plus = true; } else { res.num = subtraction(b.num, a.num); res.plus = false; } } else if (!a.plus && b.plus) { if (large_or_equal(a.num, b.num)) { res.num = subtraction(a.num, b.num); res.plus = false; } else { res.num = subtraction(b.num, a.num); res.plus = true; } } else { res.num = addition(a.num, b.num); res.plus = false; } return res; } int main() { int n; cin >> n; auto conv = [](string s) { if (s[0] == '-') { s.erase(0, 1); } int n = s.size(); int id = -1; rep(i, n) { if (s[i] == '.') { id = i; } } string res = ""; if (id == -1) { res = s; rep(i, 10) { res += "0"; } } else { res = s.substr(0, id); res += s.substr(id + 1); rep(i, 10 - (n - id - 1)) { res += "0"; } } while (res.size() >= 2 && res[0] == '0') { res.erase(0, 1); } return res; }; auto show = [](bint x) { vector v = x.num; int n = v.size(); for (int i = 0; i < 10 - n; i++) { v.emplace_back(0); } n = v.size(); string res = ""; for (int i = 0; i < 10; i++) { res += v[i] + '0'; } res += "."; for (int i = 10; i < n; i++) { res += v[i] + '0'; } if (n == 10) { res += "0"; } if (!x.plus) { res += "-"; } reverse(res.begin(), res.end()); return res; }; bint ans("0", true); while (n--) { string s; cin >> s; bint x(conv(s), (s[0] != '-')); ans = ans + x; } cout << show(ans) << endl; }