#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n;
int a[N];
pair<int, int> b[N];
long double ans[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
b[i] = make_pair(a[i], i);
}
long long tot = 0;
sort(b + 1, b + n + 1);
if (n == 1) {
cout << 0 << '\n';
cout << 0 << '\n';
return 0;
}
if (n == 2) {
cout << 0 << '\n';
cout << 0 << ' ' << -a[2] << '\n';
return 0;
}
long double l = 1.0F * b[1].first / 2, r = 1.0F * b[1].first / 2;
ans[b[1].second] = 0;
int ll = 0, rr = 0;
for (int i = 2; i <= n; i++) {
if (l <= r) {
ll++:
tot += l;
l += b[i].first;
ans[b[i].second] = -l;
} else {
rr++;
tot += r;
ans[b[i].second] = r;
r += b[i].first;
}
}
assert(abs(ll - rr) <= 1);
cout << fixed << setprecision(6) << 1.0F * tot / n << '\n';
for (int i = 1; i <= n; i++) {
cout << fixed << setprecision(6) << ans[i] << ' ';
}
return 0;
}