#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using pll = pair; using tlll = tuple; using tllll = tuple; using vll = vector; using vpll = vector; using vtlll = vector; using vtllll = vector; using vstr = vector; using vvl = vector>; constexpr ll INF = 4'000'000'000'000'000'037; template bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; } template bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; } ll safemod(ll a, ll m) { ll res = a % m; if (res < 0) res += m; return res; } ll divfloor(ll a, ll b) { if (b < 0) a = -a, b = -b; return (a - safemod(a, b)) / b; } ll divceil(ll a, ll b) { if (b < 0) a = -a, b = -b; return divfloor(a + b - 1, b); } ll pow_ll(ll a, ll b) { if (a == 0 || a == 1) return a; if (a == -1) return b & 1 ? -1 : 1; ll res = 1; for (int i = 0; i < b; i++) res *= a; return res; } ll mul_limited(ll a, ll b, ll m = INF) { return b == 0 ? 0 : a > m / b ? m : a * b; } ll pow_limited(ll a, ll b, ll m = INF) { if (a == 0 || a == 1) return a; ll res = 1; for (int i = 0; i < b; i++) { if (res > m / a) return m; res *= a; } return res; } #define overload4(_1, _2, _3, _4, name, ...) name #define rep1(i, n) for (ll i = 0; i < ll(n); i++) #define rep2(i, l, r) for (ll i = ll(l); i < ll(r); i++) #define rep3(i, l, r, d) for (ll i = ll(l); (d) > 0 ? i < ll(r) : i > ll(r); i += d) #define rep(...) overload4(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__) #define all(a) (a).begin(), (a).end() template ())> vector cuml(vector v, const F &op = plus<>(), const T &e = 0) { v.emplace_back(e); exclusive_scan(v.begin(), v.end(), v.begin(), e, op); return v; } template ())> vector cumr(vector v, const F &op = plus<>(), const T &e = 0) { v.insert(v.begin(), e); exclusive_scan(v.rbegin(), v.rend(), v.rbegin(), e, op); return v; } template vector adjd(vector v) { adjacent_difference(v.begin(), v.end(), v.begin()); return v; } template struct max_op { T operator()(const T &a, const T &b) const { return max(a, b); } }; template struct min_op { T operator()(const T &a, const T &b) const { return min(a, b); } }; struct max_e { ll operator()() const { return -INF; } }; struct min_e { ll operator()() const { return INF; } }; template vector cumlmax(const vector &v) { return cuml(v, max_op(), max_e()()); } template vector cumrmax(const vector &v) { return cumr(v, max_op(), max_e()()); } template vector cumlmin(const vector &v) { return cuml(v, min_op(), min_e()()); } template vector cumrmin(const vector &v) { return cumr(v, min_op(), min_e()()); } template vector sorted(vector v) { sort(v.begin(), v.end()); return v; } template vector reversed(const vector &v) { return {v.rbegin(), v.rend()}; } template void unique(vector &v) { v.erase(unique(v.begin(), v.end()), v.end()); } template void sortunique(vector &v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); } template void rotate(vector v, int k) { rotate(v.begin(), v.begin() + k, v.end()); } template vector rotated(vector v, int k) { rotate(v.begin(), v.begin() + k, v.end()); return v; } string sorted(string s) { sort(s.begin(), s.end()); return s; } string reversed(const string &s) { return {s.rbegin(), s.rend()}; } void unique(string &s) { s.erase(unique(s.begin(), s.end()), s.end()); } void sortunique(string &s) { sort(s.begin(), s.end()); s.erase(unique(s.begin(), s.end()), s.end()); } void rotate(string &s, int k) { rotate(s.begin(), s.begin() + k, s.end()); } string rotated(string s, int k) { rotate(s.begin(), s.begin() + k, s.end()); return s; } template vector> transposed(const vector> &a) { const size_t n = a.size(), m = a.at(0).size(); vector> b(m, vector(n)); for (size_t i = 0; i < n; i++) for (size_t j = 0; j < m; j++) b[j][i] = a[i].at(j); return b; } template array, m> transposed(const vector> &a) { const size_t n = a.size(); array, m> b; b.fill(vector(n)); for (size_t i = 0; i < n; i++) for (size_t j = 0; j < m; j++) b[j][i] = a[i][j]; return b; } template vector> transposed(const array, n> &a) { const size_t m = a.at(0).size(); vector> b(m); for (size_t i = 0; i < n; i++) for (size_t j = 0; j < m; j++) b[j][i] = a[i].at(j); return b; } template pair, vector> transposed(const vector> &a) { const size_t n = a.size(); vector b(n); vector c(n); for (size_t i = 0; i < n; i++) b[i] = a[i].first, c[i] = a[i].second; return make_pair(b, c); } template vector> transposed(const pair, vector> &a) { const size_t n = a.first.size(); vector> b(n); for (size_t i = 0; i < n; i++) b[i] = make_pair(a.first[i], a.second.at(i)); return b; } template tuple, vector, vector> transposed(const vector> &a) { const size_t n = a.size(); vector b(n); vector c(n); vector d(n); for (size_t i = 0; i < n; i++) b[i] = get<0>(a[i]), c[i] = get<1>(a[i]), d[i] = get<2>(a[i]); return make_tuple(b, c, d); } template vector> transposed(const tuple, vector, vector> &a) { const size_t n = get<0>(a).size(); vector> b(n); for (size_t i = 0; i < n; i++) b[i] = make_tuple(get<0>(a)[i], get<1>(a).at(i), get<2>(a).at(i)); return b; } template tuple, vector, vector, vector> transposed(const vector> &a) { const size_t n = a.size(); vector b(n); vector c(n); vector d(n); vector e(n); for (size_t i = 0; i < n; i++) b[i] = get<0>(a[i]), c[i] = get<1>(a[i]), d[i] = get<2>(a[i]), e[i] = get<3>(a[i]); return make_tuple(b, c, d, e); } template vector> transposed(const tuple, vector, vector, vector> &a) { const size_t n = get<0>(a).size(); vector> b(n); for (size_t i = 0; i < n; i++) b[i] = make_tuple(get<0>(a)[i], get<1>(a).at(i), get<2>(a).at(i), get<3>(a).at(i)); return b; } template vector digitvec(const string &s) { int n = s.size(); vector a(n); for (int i = 0; i < n; i++) a[i] = s[i] - '0'; return a; } #if __cplusplus < 202002L ull bit_ceil(ull x) { ull y = 1; while (y < x) y <<= 1; return y; } ull bit_floor(ull x) { ull y = 1; while (y <= x) y <<= 1; return y >> 1; } ull bit_width(ull x) { ull y = 1, z = 0; while (y <= x) y <<= 1, z++; return z; } ull countr_zero(ull x) { return __builtin_ctzll(x); } ull popcount(ull x) { return __builtin_popcountll(x); } ull has_single_bit(ull x) { return popcount(x) == 1; } #endif ull lsb_index(ull x) { assert(x != 0); return countr_zero(x); } ull msb_index(ull x) { assert(x != 0); return bit_width(x) - 1; } ull lsb_mask(ull x) { assert(x != 0); return x & -x; } ull msb_mask(ull x) { assert(x != 0); return bit_floor(x); } #if __has_include() #include using namespace atcoder; template * = nullptr> istream &operator>>(istream &is, T &a) { ll v; is >> v; a = v; return is; } template * = nullptr> ostream &operator<<(ostream &os, const T &a) { os << a.val(); return os; } #endif template istream &operator>>(istream &is, pair &p) { is >> p.first >> p.second; return is; } template istream &operator>>(istream &is, tuple &t) { is >> get<0>(t) >> get<1>(t) >> get<2>(t); return is; } template istream &operator>>(istream &is, tuple &t) { is >> get<0>(t) >> get<1>(t) >> get<2>(t) >> get<3>(t); return is; } template istream &operator>>(istream &is, array &a) { for (size_t i = 0; i < N; i++) is >> a[i]; return is; } template void input(T&... a) { (cin >> ... >> a); } template void inputvec(int n, vector &v) { v.resize(n); for (int i = 0; i < n; i++) cin >> v[i]; } template void inputvec(int n, vector& v, vector&... vs) { inputvec(n, v); inputvec(n, vs...); } template void inputvec2(int n, int m, vector> &v) { v.assign(n, vector(m)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> v[i][j]; } template void inputvec2(int n, int m, vector& v, vector&... vs) { inputvec2(n, m, v); inputvec2(n, m, vs...); } template void print(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; } #define INT(...) int __VA_ARGS__; input(__VA_ARGS__) #define LL(...) ll __VA_ARGS__; input(__VA_ARGS__) #define STR(...) string __VA_ARGS__; input(__VA_ARGS__) #define VINT(n, ...) vector __VA_ARGS__; inputvec(n, __VA_ARGS__) #define VLL(n, ...) vector __VA_ARGS__; inputvec(n, __VA_ARGS__) #define VSTR(n, ...) vector __VA_ARGS__; inputvec(n, __VA_ARGS__) #define VPLL(n, ...) vector __VA_ARGS__; inputvec(n, __VA_ARGS__) #define VTLLL(n, ...) vector __VA_ARGS__; inputvec(n, __VA_ARGS__) #define VTLLLL(n, ...) vector __VA_ARGS__; inputvec(n, __VA_ARGS__) #define AL(n, ...) array __VA_ARGS__; input(__VA_ARGS__) #define VAL(n, m, ...) vector> __VA_ARGS__; inputvec(n, __VA_ARGS__) #define VVL(n, m, ...) vector> __VA_ARGS__; inputvec2(n, m, __VA_ARGS__) #define FINALANS(x) do { cout << (x) << '\n'; exit(0); } while (false) template void printvec(const vector &v) { int n = v.size(); for (int i = 0; i < n; i++) cout << v[i] << (i == n - 1 ? "" : " "); cout << '\n'; } template void printvect(const vector &v) { for (auto &vi : v) cout << vi << '\n';} template void printvec2(const vector> &v) { for (auto &vi : v) printvec(vi); } #if __has_include() using mint = modint998244353; //using mint = modint1000000007; //using mint = modint; #define MINT(...) mint __VA_ARGS__; input(__VA_ARGS__); #define VMINT(n, ...) vector __VA_ARGS__; inputvec(n, __VA_ARGS__) #endif #ifdef LOCAL // https://zenn.dev/sassan/articles/19db660e4da0a4 #include "/Users/Shared/cpp-dump-main/dump.hpp" #define dump(...) cpp_dump(__VA_ARGS__) CPP_DUMP_DEFINE_EXPORT_OBJECT(mint, val()); CPP_DUMP_DEFINE_DANGEROUS_EXPORT_OBJECT(val()); #else #define dump(...) #endif int main() { LL(N); VLL(N, A); ranges::sort(A); mint x = 0; rep(i, N) { x = 10 * x + A.at(i); } cout << x << endl; }