QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#104791#6397. Master of Both IIImaspyAC ✓464ms36012kbC++2019.2kb2023-05-11 23:26:062023-05-11 23:26:09

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-11 23:26:09]
  • 评测
  • 测评结果:AC
  • 用时:464ms
  • 内存:36012kb
  • [2023-05-11 23:26:06]
  • 提交

answer

#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#define vv(type, name, h, ...) \
  vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...)   \
  vector<vector<vector<type>>> name( \
      h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)       \
  vector<vector<vector<vector<type>>>> name( \
      a, vector<vector<vector<type>>>(       \
             b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))

// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)

#define FOR_subset(t, s) \
  for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T, typename U>
T ceil(T x, U y) {
  return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
  return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <typename T, typename U>
T SUM(const vector<U> &A) {
  T sum = 0;
  for (auto &&a: A) sum += a;
  return sum;
}

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
  sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  assert(!que.empty());
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  assert(!que.empty());
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
  }
  return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
  FOR(iter) {
    double x = (ok + ng) / 2;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
  }
  return (ok + ng) / 2;
}

template <class T, class S>
inline bool chmax(T &a, const S &b) {
  return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
  return (a > b ? a = b, 1 : 0);
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
  int N = A.size();
  vector<T> B(N + 1);
  FOR(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
  vector<int> ids(len(A));
  iota(all(ids), 0);
  sort(all(ids),
       [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}
#endif
#line 1 "library/other/io.hpp"
// based on yosupo's fastio
#include <unistd.h>

namespace fastio {
#define FASTIO
// クラスが read(), print() を持っているかを判定するメタ関数
struct has_write_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.write(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_write : public decltype(has_write_impl::check<T>(std::declval<T>())) {
};

struct has_read_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.read(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_read : public decltype(has_read_impl::check<T>(std::declval<T>())) {};

struct Scanner {
  FILE *fp;
  char line[(1 << 15) + 1];
  size_t st = 0, ed = 0;
  void reread() {
    memmove(line, line + st, ed - st);
    ed -= st;
    st = 0;
    ed += fread(line + ed, 1, (1 << 15) - ed, fp);
    line[ed] = '\0';
  }
  bool succ() {
    while (true) {
      if (st == ed) {
        reread();
        if (st == ed) return false;
      }
      while (st != ed && isspace(line[st])) st++;
      if (st != ed) break;
    }
    if (ed - st <= 50) {
      bool sep = false;
      for (size_t i = st; i < ed; i++) {
        if (isspace(line[i])) {
          sep = true;
          break;
        }
      }
      if (!sep) reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    while (true) {
      size_t sz = 0;
      while (st + sz < ed && !isspace(line[st + sz])) sz++;
      ref.append(line + st, sz);
      st += sz;
      if (!sz || st != ed) break;
      reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    bool neg = false;
    if (line[st] == '-') {
      neg = true;
      st++;
    }
    ref = T(0);
    while (isdigit(line[st])) { ref = 10 * ref + (line[st++] & 0xf); }
    if (neg) ref = -ref;
    return true;
  }
  template <typename T,
            typename enable_if<has_read<T>::value>::type * = nullptr>
  inline bool read_single(T &x) {
    x.read();
    return true;
  }
  bool read_single(double &ref) {
    string s;
    if (!read_single(s)) return false;
    ref = std::stod(s);
    return true;
  }
  bool read_single(char &ref) {
    string s;
    if (!read_single(s) || s.size() != 1) return false;
    ref = s[0];
    return true;
  }
  template <class T>
  bool read_single(vector<T> &ref) {
    for (auto &d: ref) {
      if (!read_single(d)) return false;
    }
    return true;
  }
  template <class T, class U>
  bool read_single(pair<T, U> &p) {
    return (read_single(p.first) && read_single(p.second));
  }
  template <size_t N = 0, typename T>
  void read_single_tuple(T &t) {
    if constexpr (N < std::tuple_size<T>::value) {
      auto &x = std::get<N>(t);
      read_single(x);
      read_single_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool read_single(tuple<T...> &tpl) {
    read_single_tuple(tpl);
    return true;
  }
  void read() {}
  template <class H, class... T>
  void read(H &h, T &... t) {
    bool f = read_single(h);
    assert(f);
    read(t...);
  }
  Scanner(FILE *fp) : fp(fp) {}
};

struct Printer {
  Printer(FILE *_fp) : fp(_fp) {}
  ~Printer() { flush(); }

  static constexpr size_t SIZE = 1 << 15;
  FILE *fp;
  char line[SIZE], small[50];
  size_t pos = 0;
  void flush() {
    fwrite(line, 1, pos, fp);
    pos = 0;
  }
  void write(const char val) {
    if (pos == SIZE) flush();
    line[pos++] = val;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  void write(T val) {
    if (pos > (1 << 15) - 50) flush();
    if (val == 0) {
      write('0');
      return;
    }
    if (val < 0) {
      write('-');
      val = -val; // todo min
    }
    size_t len = 0;
    while (val) {
      small[len++] = char(0x30 | (val % 10));
      val /= 10;
    }
    for (size_t i = 0; i < len; i++) { line[pos + i] = small[len - 1 - i]; }
    pos += len;
  }
  void write(const string s) {
    for (char c: s) write(c);
  }
  void write(const char *s) {
    size_t len = strlen(s);
    for (size_t i = 0; i < len; i++) write(s[i]);
  }
  void write(const double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  void write(const long double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  template <typename T,
            typename enable_if<has_write<T>::value>::type * = nullptr>
  inline void write(T x) {
    x.write();
  }
  template <class T>
  void write(const vector<T> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  template <class T, class U>
  void write(const pair<T, U> val) {
    write(val.first);
    write(' ');
    write(val.second);
  }
  template <size_t N = 0, typename T>
  void write_tuple(const T t) {
    if constexpr (N < std::tuple_size<T>::value) {
      if constexpr (N > 0) { write(' '); }
      const auto x = std::get<N>(t);
      write(x);
      write_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool write(tuple<T...> tpl) {
    write_tuple(tpl);
    return true;
  }
  template <class T, size_t S>
  void write(const array<T, S> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  void write(i128 val) {
    string s;
    bool negative = 0;
    if (val < 0) {
      negative = 1;
      val = -val;
    }
    while (val) {
      s += '0' + int(val % 10);
      val /= 10;
    }
    if (negative) s += "-";
    reverse(all(s));
    if (len(s) == 0) s = "0";
    write(s);
  }
};
Scanner scanner = Scanner(stdin);
Printer printer = Printer(stdout);
void flush() { printer.flush(); }
void print() { printer.write('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  printer.write(head);
  if (sizeof...(Tail)) printer.write(' ');
  print(forward<Tail>(tail)...);
}

void read() {}
template <class Head, class... Tail>
void read(Head &head, Tail &... tail) {
  scanner.read(head);
  read(tail...);
}
} // namespace fastio
using fastio::print;
using fastio::flush;
using fastio::read;

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define STR(...)      \
  string __VA_ARGS__; \
  read(__VA_ARGS__)
#define CHAR(...)   \
  char __VA_ARGS__; \
  read(__VA_ARGS__)
#define DBL(...)      \
  double __VA_ARGS__; \
  read(__VA_ARGS__)

#define VEC(type, name, size) \
  vector<type> name(size);    \
  read(name)
#define VV(type, name, h, w)                     \
  vector<vector<type>> name(h, vector<type>(w)); \
  read(name)

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"

#line 2 "library/mod/modint_common.hpp"

struct has_mod_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.get_mod(), std::true_type{});
  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_mod : public decltype(has_mod_impl::check<T>(std::declval<T>())) {};


template <typename mint>
mint inv(int n) {
  static const int mod = mint::get_mod();
  static vector<mint> dat = {0, 1};
  assert(0 <= n);
  if (n >= mod) n %= mod;
  while (len(dat) <= n) {
    int k = len(dat);
    int q = (mod + k - 1) / k;
    dat.eb(dat[k * q - mod] * mint(q));
  }
  return dat[n];
}

template <typename mint>
mint fact(int n) {
  static const int mod = mint::get_mod();
  assert(0 <= n);
  if (n >= mod) return 0;
  static vector<mint> dat = {1, 1};
  while (len(dat) <= n) dat.eb(dat[len(dat) - 1] * mint(len(dat)));
  return dat[n];
}

template <typename mint>
mint fact_inv(int n) {
  static const int mod = mint::get_mod();
  assert(-1 <= n && n < mod);
  static vector<mint> dat = {1, 1};
  if (n == -1) return mint(0);
  while (len(dat) <= n) dat.eb(dat[len(dat) - 1] * inv<mint>(len(dat)));
  return dat[n];
}

template <class mint, class... Ts>
mint fact_invs(Ts... xs) {
  return (mint(1) * ... * fact_inv<mint>(xs));
}

template <typename mint, class Head, class... Tail>
mint multinomial(Head &&head, Tail &&... tail) {
  return fact<mint>(head) * fact_invs<mint>(std::forward<Tail>(tail)...);
}

template <typename mint>
mint C_dense(int n, int k) {
  static vvc<mint> C;
  static int H = 0, W = 0;
  auto calc = [&](int i, int j) -> mint {
    if (i == 0) return (j == 0 ? mint(1) : mint(0));
    return C[i - 1][j] + (j ? C[i - 1][j - 1] : 0);
  };
  if (W <= k) {
    FOR(i, H) {
      C[i].resize(k + 1);
      FOR(j, W, k + 1) { C[i][j] = calc(i, j); }
    }
    W = k + 1;
  }
  if (H <= n) {
    C.resize(n + 1);
    FOR(i, H, n + 1) {
      C[i].resize(W);
      FOR(j, W) { C[i][j] = calc(i, j); }
    }
    H = n + 1;
  }
  return C[n][k];
}

template <typename mint, bool large = false, bool dense = false>
mint C(ll n, ll k) {
  assert(n >= 0);
  if (k < 0 || n < k) return 0;
  if (dense) return C_dense<mint>(n, k);
  if (!large) return multinomial<mint>(n, k, n - k);
  k = min(k, n - k);
  mint x(1);
  FOR(i, k) x *= mint(n - i);
  return x * fact_inv<mint>(k);
}

template <typename mint, bool large = false>
mint C_inv(ll n, ll k) {
  assert(n >= 0);
  assert(0 <= k && k <= n);
  if (!large) return fact_inv<mint>(n) * fact<mint>(k) * fact<mint>(n - k);
  return mint(1) / C<mint, 1>(n, k);
}

// [x^d] (1-x) ^ {-n} の計算
template <typename mint, bool large = false, bool dense = false>
mint C_negative(ll n, ll d) {
  assert(n >= 0);
  if (d < 0) return mint(0);
  if (n == 0) { return (d == 0 ? mint(1) : mint(0)); }
  return C<mint, large, dense>(n + d - 1, d);
}
#line 3 "library/mod/modint.hpp"

template <int mod>
struct modint {
  int val;
  constexpr modint(const ll val = 0) noexcept
      : val(val >= 0 ? val % mod : (mod - (-val) % mod) % mod) {}
  bool operator<(const modint &other) const {
    return val < other.val;
  } // To use std::map
  modint &operator+=(const modint &p) {
    if ((val += p.val) >= mod) val -= mod;
    return *this;
  }
  modint &operator-=(const modint &p) {
    if ((val += mod - p.val) >= mod) val -= mod;
    return *this;
  }
  modint &operator*=(const modint &p) {
    val = (int)(1LL * val * p.val % mod);
    return *this;
  }
  modint &operator/=(const modint &p) {
    *this *= p.inverse();
    return *this;
  }
  modint operator-() const { return modint(-val); }
  modint operator+(const modint &p) const { return modint(*this) += p; }
  modint operator-(const modint &p) const { return modint(*this) -= p; }
  modint operator*(const modint &p) const { return modint(*this) *= p; }
  modint operator/(const modint &p) const { return modint(*this) /= p; }
  bool operator==(const modint &p) const { return val == p.val; }
  bool operator!=(const modint &p) const { return val != p.val; }
  modint inverse() const {
    int a = val, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b), swap(u -= t * v, v);
    }
    return modint(u);
  }
  modint pow(ll n) const {
    assert(n >= 0);
    modint ret(1), mul(val);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
#ifdef FASTIO
  void write() { fastio::printer.write(val); }
  void read() { fastio::scanner.read(val); }
#endif
  static constexpr int get_mod() { return mod; }
  // (n, r), r は 1 の 2^n 乗根
  static constexpr pair<int, int> ntt_info() {
    if (mod == 167772161) return {25, 17};
    if (mod == 469762049) return {26, 30};
    if (mod == 754974721) return {24, 362};
    if (mod == 880803841) return {23, 211};
    if (mod == 998244353) return {23, 31};
    if (mod == 1045430273) return {20, 363};
    if (mod == 1051721729) return {20, 330};
    if (mod == 1053818881) return {20, 2789};
    return {-1, -1};
  }
  static constexpr bool can_ntt() { return ntt_info().fi != -1; }
};

using modint107 = modint<1000000007>;
using modint998 = modint<998244353>;
#line 5 "main.cpp"

using mint = modint998;

void solve() {
  LL(N);
  VEC(ll, A, N);

  vi dp(1 << N, infty<ll>);
  dp[1] = 0;

  FOR(s, 1, 1 << N) {
    FOR(i, 1, N) {
      ll t = s << (N - i);
      ll hi = t >> N;
      ll lo = t - (hi << N);
      t = lo | hi;
      chmin(dp[s | t], dp[s] + A[i]);
    };
  }
  FOR(i, N) FOR(s, 1 << N) {
    int t = s | 1 << i;
    if (s < t) chmin(dp[s], dp[t]);
  }
  i128 ANS = 0;
  FOR(s, 1 << N) ANS += dp[s] * s;
  print(ANS % 998244353);
}

signed main() {
  solve();
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3412kb

input:

3
2 1 2

output:

45

result:

ok 1 number(s): "45"

Test #2:

score: 0
Accepted
time: 2ms
memory: 3428kb

input:

4
1919810 999999998 999999997 114114514

output:

152175989

result:

ok 1 number(s): "152175989"

Test #3:

score: 0
Accepted
time: 2ms
memory: 3512kb

input:

3
842160586 705327547 868243944

output:

78597628

result:

ok 1 number(s): "78597628"

Test #4:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

5
198327434 147392532 760837755 771109105 676721155

output:

751568230

result:

ok 1 number(s): "751568230"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

10
831766351 33417723 223739726 80131988 348810263 415437931 119999060 799356097 512022962 23197703

output:

308170104

result:

ok 1 number(s): "308170104"

Test #6:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

12
892965903 35291219 261557729 131390943 457251874 944586973 724767219 190756777 658923976 587806068 793999675 378390067

output:

964920873

result:

ok 1 number(s): "964920873"

Test #7:

score: 0
Accepted
time: 2ms
memory: 3544kb

input:

14
249132751 477356204 594343028 32906794 270726189 883801423 329535378 877124753 100792287 152414432 142520554 196476850 924736849 383197276

output:

796031217

result:

ok 1 number(s): "796031217"

Test #8:

score: 0
Accepted
time: 74ms
memory: 11196kb

input:

20
627365465 726842612 947302944 649244156 293375951 318148820 237155023 981487641 688151803 844901013 430309799 733877736 520864483 720366437 28746495 143052089 306590290 18586578 662663479 375430013

output:

179404754

result:

ok 1 number(s): "179404754"

Test #9:

score: 0
Accepted
time: 166ms
memory: 19436kb

input:

21
805448889 595358753 391340394 525130530 272725205 157594893 261894302 29704333 909085958 127205196 104570238 495437480 458664573 599968678 690908307 220500006 735062204 172834136 241126905 814694254 294923292

output:

260115885

result:

ok 1 number(s): "260115885"

Test #10:

score: 0
Accepted
time: 373ms
memory: 35724kb

input:

22
983532313 168907597 985120947 845727304 401817563 702073670 841923182 372888321 835052818 409509378 73797974 256997223 101497367 919762407 912878630 297947923 723342631 32114398 409524923 253958495 441987041 591475412

output:

428320025

result:

ok 1 number(s): "428320025"

Test #11:

score: 0
Accepted
time: 162ms
memory: 19352kb

input:

21
11 15 20 22 23 41 78 144 266 522 1025 2051 4114 8206 16404 32788 65554 131084 262147 524308 1048583

output:

975218988

result:

ok 1 number(s): "975218988"

Test #12:

score: 0
Accepted
time: 386ms
memory: 35796kb

input:

22
5 7 13 23 33 35 74 144 274 518 1025 2050 4108 8210 16385 32771 65555 131076 262158 524305 1048593 2097169

output:

430862284

result:

ok 1 number(s): "430862284"

Test #13:

score: 0
Accepted
time: 65ms
memory: 11136kb

input:

20
7 8 14 20 22 51 71 148 257 513 1042 2058 4116 8212 16397 32779 65556 131088 262148 524302

output:

305207398

result:

ok 1 number(s): "305207398"

Test #14:

score: 0
Accepted
time: 172ms
memory: 19436kb

input:

21
1048588 524308 262158 131078 65556 32772 16387 8203 4115 2051 1029 519 262 149 76 43 21 16 15 12 10

output:

120441696

result:

ok 1 number(s): "120441696"

Test #15:

score: 0
Accepted
time: 376ms
memory: 35800kb

input:

22
2097156 1048596 524291 262146 131080 65550 32785 16398 8209 4110 2062 1033 525 274 143 68 35 26 20 18 12 6

output:

733598329

result:

ok 1 number(s): "733598329"

Test #16:

score: 0
Accepted
time: 67ms
memory: 11248kb

input:

20
524296 262146 131082 65541 32773 16396 8202 4099 2065 1028 526 265 145 74 39 33 19 15 10 3

output:

441419655

result:

ok 1 number(s): "441419655"

Test #17:

score: 0
Accepted
time: 164ms
memory: 19404kb

input:

21
8193 27 1041 23 4097 32782 140 16403 262147 65 131074 516 524302 9 2060 65556 273 1048596 6 19 49

output:

704360700

result:

ok 1 number(s): "704360700"

Test #18:

score: 0
Accepted
time: 387ms
memory: 35800kb

input:

22
2097156 524300 139 12 262159 10 52 16 257 131076 16397 1035 65542 2062 4099 515 1048578 16 35 74 32786 8196

output:

130643050

result:

ok 1 number(s): "130643050"

Test #19:

score: 0
Accepted
time: 71ms
memory: 11136kb

input:

20
143 19 21 16403 262145 8210 1034 71 9 266 524303 32780 26 34 516 131092 2055 11 65553 4110

output:

877055041

result:

ok 1 number(s): "877055041"

Test #20:

score: 0
Accepted
time: 167ms
memory: 19632kb

input:

21
12 13 124013445 165165233 302521359 335939286 338126181 401926382 473978786 482365940 504814524 527374498 713266663 723409251 770861632 772613010 790560972 821461929 923487261 947732496 984576455

output:

302494363

result:

ok 1 number(s): "302494363"

Test #21:

score: 0
Accepted
time: 163ms
memory: 19356kb

input:

21
8 216683733 225654691 345690335 386019313 418392558 492201820 555866312 581843628 635678233 670026131 711790397 752745658 755273648 768833218 776829634 813365711 959068723 959282924 975993831 984177503

output:

68559536

result:

ok 1 number(s): "68559536"

Test #22:

score: 0
Accepted
time: 157ms
memory: 19436kb

input:

21
1 12 20 120386050 182099280 222752712 222913665 257195402 324758490 382442048 406256231 457956698 467779588 567857336 661061515 728222301 797983727 806341835 868802360 907297649 916281494

output:

560211391

result:

ok 1 number(s): "560211391"

Test #23:

score: 0
Accepted
time: 158ms
memory: 19328kb

input:

21
2 4 6 8 129857468 138172632 145723608 216575771 220505315 295628393 417753389 521498774 521930079 529939110 546550164 646996686 680636133 774918459 802645920 927055494 932188564

output:

981964824

result:

ok 1 number(s): "981964824"

Test #24:

score: 0
Accepted
time: 180ms
memory: 19372kb

input:

21
4 6 8 9 20 136797969 139417914 164970720 223768780 231928019 278498831 340260688 350277118 483857556 584905789 702553546 763661796 860898268 866704419 906203662 948095633

output:

300688102

result:

ok 1 number(s): "300688102"

Test #25:

score: 0
Accepted
time: 165ms
memory: 19348kb

input:

21
2 6 7 9 12 19 130630182 135130250 179860274 191768809 280527244 300297762 302539355 357418035 367165658 415655449 481599984 731631962 766526928 777199793 837857644

output:

190763460

result:

ok 1 number(s): "190763460"

Test #26:

score: 0
Accepted
time: 158ms
memory: 19388kb

input:

21
3 6 11 12 20 20 20 135533018 149425527 221433245 247492671 304122468 404570880 423599606 434664547 578357813 790305774 864606479 879757972 919459861 977522950

output:

761718204

result:

ok 1 number(s): "761718204"

Test #27:

score: 0
Accepted
time: 166ms
memory: 19340kb

input:

21
2 4 5 7 9 9 14 14 122509068 156982362 243205007 244305861 263561256 329493184 569031332 594264883 611234529 618590217 759059448 806091068 979551364

output:

272241629

result:

ok 1 number(s): "272241629"

Test #28:

score: 0
Accepted
time: 167ms
memory: 19440kb

input:

21
1 2 2 7 8 8 10 16 20 167541246 196753990 355567428 388813160 394451146 598659034 756415859 840779873 870064449 903587285 908430826 981579777

output:

993304792

result:

ok 1 number(s): "993304792"

Test #29:

score: 0
Accepted
time: 163ms
memory: 19400kb

input:

21
1 5 7 9 10 12 13 14 17 20 106018219 120744275 210020879 369081638 470845550 574169350 621761408 806151329 922269608 933136766 936649226

output:

158811861

result:

ok 1 number(s): "158811861"

Test #30:

score: 0
Accepted
time: 159ms
memory: 19428kb

input:

21
4 5 5 6 9 10 11 11 11 13 19 171016010 212049293 342459167 465184125 524617335 532940894 549760108 697962892 734123829 860646834

output:

793601692

result:

ok 1 number(s): "793601692"

Test #31:

score: 0
Accepted
time: 159ms
memory: 19384kb

input:

21
1 3 9 9 10 10 11 12 12 14 15 19 212599545 278601073 305382795 563398946 613733490 643863450 729836165 776733467 959863569

output:

794407245

result:

ok 1 number(s): "794407245"

Test #32:

score: 0
Accepted
time: 169ms
memory: 19432kb

input:

21
1 3 7 7 7 12 14 14 15 16 17 17 18 133664733 453952084 579306015 677706872 771632343 842198586 849814998 985234286

output:

41273062

result:

ok 1 number(s): "41273062"

Test #33:

score: 0
Accepted
time: 170ms
memory: 19400kb

input:

21
2 6 7 8 9 11 11 12 13 14 14 15 18 20 314015054 653297629 717189669 728498726 837910922 888628418 984181784

output:

152473669

result:

ok 1 number(s): "152473669"

Test #34:

score: 0
Accepted
time: 166ms
memory: 19436kb

input:

21
2 2 3 6 7 7 9 9 10 13 13 15 15 16 16 218300010 218548568 537527677 717271011 873047851 904535488

output:

766144564

result:

ok 1 number(s): "766144564"

Test #35:

score: 0
Accepted
time: 168ms
memory: 19632kb

input:

21
2 3 4 5 5 8 9 9 11 12 12 13 14 19 19 20 225475265 327047938 557948062 692861769 964450352

output:

63919771

result:

ok 1 number(s): "63919771"

Test #36:

score: 0
Accepted
time: 156ms
memory: 19320kb

input:

21
3 4 4 5 5 6 6 7 9 9 10 11 14 16 17 18 20 241382335 279496067 692314847 756835151

output:

968243564

result:

ok 1 number(s): "968243564"

Test #37:

score: 0
Accepted
time: 165ms
memory: 19436kb

input:

21
1 1 3 3 3 4 6 7 7 8 9 12 12 13 16 19 20 20 131714340 330873949 550704737

output:

331552433

result:

ok 1 number(s): "331552433"

Test #38:

score: 0
Accepted
time: 159ms
memory: 19440kb

input:

21
1 1 1 3 8 8 9 9 11 11 13 13 14 15 15 15 16 18 18 101431998 566611807

output:

496652396

result:

ok 1 number(s): "496652396"

Test #39:

score: 0
Accepted
time: 164ms
memory: 19324kb

input:

21
1 2 2 2 3 3 5 5 6 6 7 8 9 10 10 13 16 16 17 19 469148962

output:

590122358

result:

ok 1 number(s): "590122358"

Test #40:

score: 0
Accepted
time: 166ms
memory: 19644kb

input:

21
999555504 911354638 889343130 702771132 656169624 600578828 558213918 528749384 520183039 514519129 452462885 394955786 383438754 367568798 351352513 340128320 231649055 226724828 160812637 18 3

output:

493749325

result:

ok 1 number(s): "493749325"

Test #41:

score: 0
Accepted
time: 161ms
memory: 19284kb

input:

21
956325037 920511263 905154503 885983922 802244851 736509953 681904836 649055510 634186043 526720970 508936332 479309408 475856778 413328522 295601218 293579350 279703882 259955917 199982142 130431800 18

output:

966007244

result:

ok 1 number(s): "966007244"

Test #42:

score: 0
Accepted
time: 158ms
memory: 19640kb

input:

21
992861843 839155091 834151122 823841531 785757625 784757070 721468976 712314229 692580703 599399596 485031001 438277312 347064849 325745089 238121226 205120654 193758294 188769533 14 11 5

output:

568825101

result:

ok 1 number(s): "568825101"

Test #43:

score: 0
Accepted
time: 170ms
memory: 19288kb

input:

21
996117513 839748601 778560189 678754677 654071684 626197684 567973686 492027025 459427270 327773502 314074272 297493166 267290870 258615320 239757713 161092122 131980196 20 18 15 11

output:

386907963

result:

ok 1 number(s): "386907963"

Test #44:

score: 0
Accepted
time: 161ms
memory: 19292kb

input:

21
984063020 965810495 949550740 890570704 887173134 855655670 761033115 731353875 652995773 518354263 471379690 468303420 455139606 408055422 262807678 107812705 19 19 14 8 1

output:

497331226

result:

ok 1 number(s): "497331226"

Test #45:

score: 0
Accepted
time: 168ms
memory: 19252kb

input:

21
938414998 857006452 825006497 818132245 810779185 752106704 731810609 710908712 702001207 679793862 652608963 567502027 357953850 341173221 176595448 11 8 7 5 3 3

output:

368217679

result:

ok 1 number(s): "368217679"

Test #46:

score: 0
Accepted
time: 173ms
memory: 19436kb

input:

21
945145970 800597255 735410702 706591950 624972104 514070478 485917850 442864095 402586145 293621350 269799030 224292611 200924773 142410246 13 11 11 9 7 5 4

output:

441317824

result:

ok 1 number(s): "441317824"

Test #47:

score: 0
Accepted
time: 167ms
memory: 19628kb

input:

21
938422748 937153023 864570637 854908512 852654148 737439116 713128605 675576784 532211530 501824920 342910291 263202103 179512754 19 17 15 12 10 10 10 5

output:

839537178

result:

ok 1 number(s): "839537178"

Test #48:

score: 0
Accepted
time: 174ms
memory: 19280kb

input:

21
965220836 928544018 776752609 690124778 600069568 518912248 517731989 377873787 315428146 241019488 185314512 110444208 19 12 9 8 6 4 3 2 1

output:

497331226

result:

ok 1 number(s): "497331226"

Test #49:

score: 0
Accepted
time: 175ms
memory: 19356kb

input:

21
959267360 877481412 828524043 773680944 747114367 677588189 651036367 609755574 498077668 286071658 266013389 20 18 16 16 15 13 10 7 6 2

output:

994662452

result:

ok 1 number(s): "994662452"

Test #50:

score: 0
Accepted
time: 160ms
memory: 19276kb

input:

21
986910591 920042458 735022689 655814673 611783988 594018951 316880905 260012404 201114454 175296284 20 16 13 12 10 10 9 9 8 3 3

output:

401069322

result:

ok 1 number(s): "401069322"

Test #51:

score: 0
Accepted
time: 175ms
memory: 19628kb

input:

21
690600507 656280399 489006427 350648665 307850369 254066859 167342116 153562583 120941625 19 18 18 17 16 15 11 9 8 7 3 2

output:

413212129

result:

ok 1 number(s): "413212129"

Test #52:

score: 0
Accepted
time: 166ms
memory: 19332kb

input:

21
957929719 790647185 754573888 740449949 507562672 368087161 323757438 136318185 17 14 13 11 10 9 8 8 5 4 4 3 3

output:

241061925

result:

ok 1 number(s): "241061925"

Test #53:

score: 0
Accepted
time: 207ms
memory: 19632kb

input:

21
778267726 633079841 275416873 254978092 230251233 230046678 123579978 18 18 14 13 12 12 12 11 10 9 7 7 3 1

output:

497331226

result:

ok 1 number(s): "497331226"

Test #54:

score: 0
Accepted
time: 173ms
memory: 19400kb

input:

21
913467850 814010889 794138028 648986910 364413463 305190401 20 16 15 14 13 13 12 11 11 10 9 5 4 2 1

output:

497331226

result:

ok 1 number(s): "497331226"

Test #55:

score: 0
Accepted
time: 149ms
memory: 19636kb

input:

21
869926689 703812957 561426309 163144118 125528408 19 19 16 13 13 12 11 11 9 9 9 8 6 5 4 3

output:

151105920

result:

ok 1 number(s): "151105920"

Test #56:

score: 0
Accepted
time: 149ms
memory: 19316kb

input:

21
833702168 279249090 220459106 143212450 17 16 15 13 13 12 10 10 10 6 6 5 4 3 2 1 1

output:

914125256

result:

ok 1 number(s): "914125256"

Test #57:

score: 0
Accepted
time: 152ms
memory: 19644kb

input:

21
295156160 277579235 202708257 19 19 18 16 14 13 13 13 12 11 10 8 7 5 4 2 1 1

output:

914125256

result:

ok 1 number(s): "914125256"

Test #58:

score: 0
Accepted
time: 156ms
memory: 19276kb

input:

21
311063229 266681639 18 18 17 17 16 16 15 15 13 11 10 9 7 7 4 3 2 1 1

output:

914125256

result:

ok 1 number(s): "914125256"

Test #59:

score: 0
Accepted
time: 160ms
memory: 19632kb

input:

21
213600385 20 20 18 18 17 15 14 11 11 10 9 8 7 7 5 5 4 4 4 1

output:

549018265

result:

ok 1 number(s): "549018265"

Test #60:

score: 0
Accepted
time: 166ms
memory: 19624kb

input:

21
541225109 392096644 981185085 571642649 701572556 819829681 663437504 872433182 767559669 883527420 216585748 584430332 881824970 723688233 483781355 383203364 483035166 634517835 873943053 5 19

output:

973145535

result:

ok 1 number(s): "973145535"

Test #61:

score: 0
Accepted
time: 172ms
memory: 19348kb

input:

21
525318040 381174950 162113641 896858784 188244706 505659757 376986162 636639415 296765557 293520869 577248953 976197708 295118341 824002369 609836775 208486486 511466163 934830325 11 386351091 391122216

output:

545233748

result:

ok 1 number(s): "545233748"

Test #62:

score: 0
Accepted
time: 163ms
memory: 19632kb

input:

21
557132179 5 379389222 768884620 566036345 751152626 261648949 655163454 3 10 682752721 470986368 180199069 537767868 184272464 831533051 366226067 230450586 932732385 601852969 749058949

output:

90344932

result:

ok 1 number(s): "90344932"

Test #63:

score: 0
Accepted
time: 172ms
memory: 19324kb

input:

21
171487289 9 807123809 795784922 860787652 14 758509082 786487593 208284113 481683414 856616383 15 7 275981623 993844859 786569468 135086604 340419524 460738765 628651057 584450674

output:

153607428

result:

ok 1 number(s): "153607428"

Test #64:

score: 0
Accepted
time: 156ms
memory: 19344kb

input:

21
392427068 331866094 871097190 635384508 6 790840564 222670849 8 801839842 843908961 15 7 655449146 350588935 547683607 11 544207429 637219112 383709661 898931889 996319632

output:

671941491

result:

ok 1 number(s): "671941491"

Test #65:

score: 0
Accepted
time: 166ms
memory: 19436kb

input:

21
408334137 11 708232516 890898892 626168830 133805551 792868978 894644225 391202850 240103280 18 13 7 728275015 700542005 19 682247234 269951385 301441424 20 682050392

output:

401072184

result:

ok 1 number(s): "401072184"

Test #66:

score: 0
Accepted
time: 166ms
memory: 19276kb

input:

21
548613023 840153880 314583680 1 638314312 107006645 11 589864682 910661330 878660042 709045323 3 1 9 523606835 426170704 12 203395990 18 717656540 121449886

output:

859919428

result:

ok 1 number(s): "859919428"

Test #67:

score: 0
Accepted
time: 158ms
memory: 19280kb

input:

21
154183267 957430617 1 16 7 297347108 389104909 218440827 298477763 6 102718982 20 10 255816671 940876121 974634712 13 280568406 20 733563609 349141600

output:

497169716

result:

ok 1 number(s): "497169716"

Test #68:

score: 0
Accepted
time: 176ms
memory: 19364kb

input:

21
608242111 707491082 11 343640801 20 1 944762529 15 300506177 634649233 17 20 143088648 967674209 9 688750145 215081403 15 595216165 954503388 12

output:

44647300

result:

ok 1 number(s): "44647300"

Test #69:

score: 0
Accepted
time: 170ms
memory: 19276kb

input:

21
777293768 13 866010071 3 738795316 17 1 498794884 8 10 183741062 379087508 15 872515699 968463365 10 579784498 715138959 13 845715468 12

output:

245107529

result:

ok 1 number(s): "245107529"

Test #70:

score: 0
Accepted
time: 159ms
memory: 19628kb

input:

21
202830149 18 13 106707172 4 18 504748265 14 6 267095051 4 107801405 868038485 888422769 13 981384512 632692092 5 577565459 13 7

output:

734793841

result:

ok 1 number(s): "734793841"

Test #71:

score: 0
Accepted
time: 167ms
memory: 19280kb

input:

21
5 9 656896335 3 5 542229643 18 252163685 254784075 18 15 7 13 904329839 487162265 13 17 738662557 778359455 6 386675830

output:

973591474

result:

ok 1 number(s): "973591474"

Test #72:

score: 0
Accepted
time: 159ms
memory: 19284kb

input:

21
2 4 333554651 559000564 2 189459268 4 19 606163773 5 16 881629137 10 313652240 8 19 6 147365545 440112951 13 15

output:

249385382

result:

ok 1 number(s): "249385382"

Test #73:

score: 0
Accepted
time: 154ms
memory: 19272kb

input:

21
4 10 390204313 8 829914235 211338927 20 9 290955948 353579193 13 329559310 14 6 9 1 321028631 6 12 8 10

output:

512583133

result:

ok 1 number(s): "512583133"

Test #74:

score: 0
Accepted
time: 151ms
memory: 19320kb

input:

21
16 5 455395416 9 111293955 1 18 4 3 3 4 550499088 186929685 524748227 2 14 3 18 12 1 912611991

output:

164811218

result:

ok 1 number(s): "164811218"

Test #75:

score: 0
Accepted
time: 153ms
memory: 19636kb

input:

21
4 9 8 7 6 11 6 589762201 538216630 1 19 859821491 660027411 6 14 8 3 18 7 2 250903066

output:

315278244

result:

ok 1 number(s): "315278244"

Test #76:

score: 0
Accepted
time: 160ms
memory: 19320kb

input:

21
4 5 8 20 5 1 3 11 3 7 12 875728560 929161695 319060207 8 7 7 7 226493824 10 1

output:

735599397

result:

ok 1 number(s): "735599397"

Test #77:

score: 0
Accepted
time: 167ms
memory: 19272kb

input:

21
12 4 17 15 11 19 290467206 17 16 3 7 891635630 3 4 10 15 14 163528479 11 6 13

output:

667891578

result:

ok 1 number(s): "667891578"

Test #78:

score: 0
Accepted
time: 173ms
memory: 19640kb

input:

21
16 12 5 6 19 354440588 10 20 10 6 9 505990740 11 19 4 12 2 10 10 6 9

output:

131101476

result:

ok 1 number(s): "131101476"

Test #79:

score: 0
Accepted
time: 187ms
memory: 19408kb

input:

21
18 1 10 5 10 17 7 12 8 20 18 16 4 810079855 5 4 20 6 18 4 3

output:

891380736

result:

ok 1 number(s): "891380736"

Test #80:

score: 0
Accepted
time: 415ms
memory: 35752kb

input:

22
6 15 268197231 270213508 351452192 492866287 531799755 552239196 566100844 615714555 621750005 623813322 631485861 697499611 720172147 827545453 837938580 852025080 853735774 926374427 980791319 982024848

output:

597142018

result:

ok 1 number(s): "597142018"

Test #81:

score: 0
Accepted
time: 416ms
memory: 35916kb

input:

22
2 162520471 173004431 198239108 244114557 302759893 463934490 480658834 482498884 488145959 511979682 519427102 528616178 555102172 578113708 586853566 597015234 703105915 711785228 721262478 902244192 944531389

output:

979133950

result:

ok 1 number(s): "979133950"

Test #82:

score: 0
Accepted
time: 421ms
memory: 35908kb

input:

22
11 14 15 426013020 454770652 455447536 471085448 504687325 526342634 548569766 562228787 568129258 627501859 631066803 700520580 708634296 719164538 751349368 802362855 853845650 896926015 961912238

output:

6994972

result:

ok 1 number(s): "6994972"

Test #83:

score: 0
Accepted
time: 419ms
memory: 35992kb

input:

22
4 7 8 14 105652325 120355457 172708839 174785427 196279023 268115567 299681118 329285529 331786382 365124962 377739197 383994167 529768966 534831571 653654704 784309498 811618337 847730551

output:

181193197

result:

ok 1 number(s): "181193197"

Test #84:

score: 0
Accepted
time: 405ms
memory: 36000kb

input:

22
3 6 9 12 14 149623537 150284620 184328839 361536658 423651264 484107830 530543907 545121215 572186085 590638986 606102834 615824964 633428898 661542481 721587666 740711226 790647028

output:

729929293

result:

ok 1 number(s): "729929293"

Test #85:

score: 0
Accepted
time: 421ms
memory: 35996kb

input:

22
7 7 7 11 16 16 159919597 211388949 338761097 348829236 355440754 500014899 574692343 642623053 642906328 713617924 872602295 875078011 889884207 960102922 975766458 986611630

output:

204507991

result:

ok 1 number(s): "204507991"

Test #86:

score: 0
Accepted
time: 436ms
memory: 35968kb

input:

22
1 4 5 5 13 15 17 131089105 223892979 314477504 417531672 431556112 515921969 524451085 601190233 619135718 626586033 638618664 669421141 806949638 960297660 977794871

output:

944898006

result:

ok 1 number(s): "944898006"

Test #87:

score: 0
Accepted
time: 418ms
memory: 35964kb

input:

22
1 6 8 10 14 15 15 18 149494299 175537062 199483736 333872312 366551138 448844289 545948376 569083380 736861747 739318309 774790576 785958808 901251939 994750290

output:

887434169

result:

ok 1 number(s): "887434169"

Test #88:

score: 0
Accepted
time: 421ms
memory: 35944kb

input:

22
2 3 5 8 8 12 15 18 18 146184149 154210320 173520864 263457118 408682966 518338958 571786281 583211074 624488092 746693421 774208133 925583936 928050028

output:

332210009

result:

ok 1 number(s): "332210009"

Test #89:

score: 0
Accepted
time: 441ms
memory: 36004kb

input:

22
1 6 7 8 8 8 11 13 15 20 245550822 291183558 316595400 384295897 526522029 590076420 652884922 658971909 665051016 707207275 712157415 719265313

output:

199530962

result:

ok 1 number(s): "199530962"

Test #90:

score: 0
Accepted
time: 464ms
memory: 35956kb

input:

22
1 2 5 11 12 14 15 15 17 17 20 146606768 163316546 191973690 406868660 517340445 599550910 605292604 661000323 680984842 728064484 859082511

output:

116806852

result:

ok 1 number(s): "116806852"

Test #91:

score: 0
Accepted
time: 460ms
memory: 36004kb

input:

22
2 3 4 5 7 8 11 13 16 16 17 20 147369904 170786125 219637448 280973553 282511220 342419595 551999039 629640559 650786981 912311699

output:

443557727

result:

ok 1 number(s): "443557727"

Test #92:

score: 0
Accepted
time: 421ms
memory: 36012kb

input:

22
5 7 7 8 12 15 15 16 16 16 16 17 19 331999869 358326664 361281796 439234373 532975220 620373047 693613941 765620118 905999128

output:

666877738

result:

ok 1 number(s): "666877738"

Test #93:

score: 0
Accepted
time: 383ms
memory: 35996kb

input:

22
3 4 7 8 9 11 11 12 14 15 16 17 17 20 255421401 259572381 311995869 327712205 374233734 669204699 754739832 858447257

output:

329573619

result:

ok 1 number(s): "329573619"

Test #94:

score: 0
Accepted
time: 383ms
memory: 35956kb

input:

22
1 3 3 4 4 7 8 11 12 14 14 16 17 19 20 107414635 194139325 196560473 683556136 733178081 785983810 938638018

output:

322334578

result:

ok 1 number(s): "322334578"

Test #95:

score: 0
Accepted
time: 381ms
memory: 35956kb

input:

22
1 1 2 2 3 4 7 9 9 11 13 14 14 17 18 20 209528623 307216879 476621835 533538819 666447432 916898481

output:

31644183

result:

ok 1 number(s): "31644183"

Test #96:

score: 0
Accepted
time: 377ms
memory: 36000kb

input:

22
2 2 4 4 5 6 6 7 8 8 8 10 11 12 16 17 18 225435692 255642483 413862853 667905605 977774929

output:

873133349

result:

ok 1 number(s): "873133349"

Test #97:

score: 0
Accepted
time: 377ms
memory: 36008kb

input:

22
2 2 2 3 5 6 7 9 11 12 12 13 14 14 17 19 20 20 107305098 241342762 346781019 934663133

output:

504705422

result:

ok 1 number(s): "504705422"

Test #98:

score: 0
Accepted
time: 383ms
memory: 35988kb

input:

22
1 1 2 2 3 4 5 5 8 9 10 11 14 15 16 19 20 20 20 410754401 420268449 550665164

output:

31644183

result:

ok 1 number(s): "31644183"

Test #99:

score: 0
Accepted
time: 389ms
memory: 35992kb

input:

22
2 3 3 4 4 5 6 6 6 7 8 9 12 13 13 15 17 17 19 20 453945260 854754279

output:

512059856

result:

ok 1 number(s): "512059856"

Test #100:

score: 0
Accepted
time: 375ms
memory: 35908kb

input:

22
955554774 947511214 868388188 852765442 809579437 774712774 745855555 710701057 684804116 684434709 679857623 608249326 572869312 547168270 540465908 506531802 438026875 327804063 323988596 211838374 17 8

output:

747925468

result:

ok 1 number(s): "747925468"

Test #101:

score: 0
Accepted
time: 376ms
memory: 35916kb

input:

22
998627382 975297506 969979850 957580773 905783467 902174840 835521050 829230082 746766169 668961783 601554686 592897078 558907767 504967180 494098737 369243715 283778382 231143506 185040286 179878781 116927474 13

output:

716256709

result:

ok 1 number(s): "716256709"

Test #102:

score: 0
Accepted
time: 368ms
memory: 36000kb

input:

22
955482833 908002903 862781884 854840926 809828937 668857474 649179023 647689150 572393660 556372978 506951489 470139166 453196107 443669172 264514057 261661869 250087929 120984301 113502410 12 3 1

output:

592612860

result:

ok 1 number(s): "592612860"

Test #103:

score: 0
Accepted
time: 383ms
memory: 35908kb

input:

22
982345465 947730674 850553262 849430081 706760446 533891213 488778609 470467260 468027157 416051238 317271029 300752716 248954447 226534590 188077354 178835027 156970281 123012715 20 20 12 5

output:

966575594

result:

ok 1 number(s): "966575594"

Test #104:

score: 0
Accepted
time: 380ms
memory: 36008kb

input:

22
998252535 962915683 931214317 894949833 865002268 849393076 716003079 693035731 628450730 526593087 497265349 437531957 332623277 328378196 211109829 146159939 111048250 18 13 10 5 3

output:

485519815

result:

ok 1 number(s): "485519815"

Test #105:

score: 0
Accepted
time: 383ms
memory: 35956kb

input:

22
934019148 827333241 715287840 713474186 668451208 665212687 528621501 485559433 435680814 407574936 407471379 289880404 231325440 218399166 208920588 167977782 19 16 13 9 4 1

output:

592612860

result:

ok 1 number(s): "592612860"

Test #106:

score: 0
Accepted
time: 385ms
memory: 35996kb

input:

22
907577369 888957216 867099022 862904328 824958927 793076696 651957335 530649915 495734055 423482006 317134524 257446193 242210515 170990440 122451295 17 17 14 13 9 9 1

output:

592612860

result:

ok 1 number(s): "592612860"

Test #107:

score: 0
Accepted
time: 383ms
memory: 35992kb

input:

22
974899425 959325712 945869597 911968517 777130053 773287444 747176955 644421784 532678328 489276991 411855357 369895523 267581231 257963306 18 13 12 11 10 7 6 3

output:

423078209

result:

ok 1 number(s): "423078209"

Test #108:

score: 0
Accepted
time: 369ms
memory: 35920kb

input:

22
974032489 953744187 899536615 860806387 695185133 623088213 586776542 556150702 526969396 516075079 428899513 329674033 193692496 20 19 18 16 16 14 13 8 1

output:

592612860

result:

ok 1 number(s): "592612860"

Test #109:

score: 0
Accepted
time: 391ms
memory: 35920kb

input:

22
980404150 903855422 897968774 881481152 863290276 853072170 742483976 726129073 666943437 625519748 456608837 363739313 19 19 16 16 15 14 13 12 11 4

output:

720569023

result:

ok 1 number(s): "720569023"

Test #110:

score: 0
Accepted
time: 372ms
memory: 35944kb

input:

22
982625997 935949527 854846397 759424799 540513948 472515907 412241305 387770057 292471663 253051747 160735017 16 15 15 14 11 11 8 6 4 4 2

output:

712875610

result:

ok 1 number(s): "712875610"

Test #111:

score: 0
Accepted
time: 375ms
memory: 35992kb

input:

22
999922909 986871019 861192335 679974423 659844613 557143400 538445448 426838448 287929369 170986673 19 18 16 16 16 15 15 14 13 10 5 1

output:

592612860

result:

ok 1 number(s): "592612860"

Test #112:

score: 0
Accepted
time: 373ms
memory: 36000kb

input:

22
962921154 924050765 846962166 770480958 738615189 561205233 560787957 500312430 102778087 20 20 17 17 17 16 14 13 10 10 7 2 1

output:

592612860

result:

ok 1 number(s): "592612860"

Test #113:

score: 0
Accepted
time: 374ms
memory: 35988kb

input:

22
950589241 703071413 665218157 594377586 232267814 205637435 139487048 118685157 16 16 16 16 13 12 11 10 10 10 6 5 3 3

output:

790002885

result:

ok 1 number(s): "790002885"

Test #114:

score: 0
Accepted
time: 441ms
memory: 35968kb

input:

22
810045098 687124771 440390524 428007559 340004220 257638530 253410382 20 20 17 17 15 15 14 13 13 10 5 4 3 3 1

output:

592612860

result:

ok 1 number(s): "592612860"

Test #115:

score: 0
Accepted
time: 371ms
memory: 36000kb

input:

22
695793094 684561205 679403715 648947338 261112711 179051187 20 20 20 19 19 18 14 13 11 7 6 6 4 4 3 2

output:

77343496

result:

ok 1 number(s): "77343496"

Test #116:

score: 0
Accepted
time: 371ms
memory: 35992kb

input:

22
869887116 813770500 646718028 448057278 354825891 19 19 18 16 16 15 15 15 14 13 10 10 9 8 8 7 5

output:

91471775

result:

ok 1 number(s): "91471775"

Test #117:

score: 0
Accepted
time: 385ms
memory: 36000kb

input:

22
425738676 423648036 341552617 279209518 20 18 16 15 14 13 12 12 10 7 5 4 3 2 1 1 1 1

output:

964410584

result:

ok 1 number(s): "964410584"

Test #118:

score: 0
Accepted
time: 372ms
memory: 36000kb

input:

22
487621418 295116587 204759325 20 19 18 18 17 15 15 15 14 14 14 12 11 10 8 3 2 1 1

output:

298538448

result:

ok 1 number(s): "298538448"

Test #119:

score: 0
Accepted
time: 380ms
memory: 35996kb

input:

22
599205702 150053513 20 19 18 16 13 12 11 10 10 9 9 9 8 6 6 4 3 2 1 1

output:

298538448

result:

ok 1 number(s): "298538448"

Test #120:

score: 0
Accepted
time: 382ms
memory: 35916kb

input:

22
345654998 2 327236741 683821974 579686121 373760221 326515402 605280443 178442576 129273610 970764945 285626376 705902664 309298083 11 846814912 214291747 926609681 460942071 940728201 855919630 601168289

output:

761195702

result:

ok 1 number(s): "761195702"

Test #121:

score: 0
Accepted
time: 382ms
memory: 35996kb

input:

22
291744295 14 120502650 506177394 187493658 181891504 378941076 696809879 462882195 441093651 793594762 839167217 185361580 591500352 176414162 971140788 932564180 146228594 738400749 228876724 652832314 174931298

output:

291134056

result:

ok 1 number(s): "291134056"

Test #122:

score: 0
Accepted
time: 383ms
memory: 36000kb

input:

22
446122545 993144376 281983124 699422650 15 300978625 754247822 479241147 561176559 564753099 648697577 850743355 16 361052799 489679230 6 875438282 633464027 753438077 993451304 224925720 954818303

output:

57343870

result:

ok 1 number(s): "57343870"

Test #123:

score: 0
Accepted
time: 389ms
memory: 36008kb

input:

22
838279960 485734318 10 472920633 706695952 692756705 376641266 988097071 189312836 340544638 733838952 243662968 895483770 280360752 17 605808854 654131590 109051445 806265456 10 877466695 20

output:

493254997

result:

ok 1 number(s): "493254997"

Test #124:

score: 0
Accepted
time: 386ms
memory: 35900kb

input:

22
15 219444267 410694892 160696039 222463856 499718722 390057881 525313213 692613999 445408440 3 264489859 124958514 620539829 455411841 586079776 100698759 215033036 4 7 14 966399957

output:

397571287

result:

ok 1 number(s): "397571287"

Test #125:

score: 0
Accepted
time: 374ms
memory: 36000kb

input:

22
979975318 561863350 328463241 16 607832407 220147205 241565028 9 128633080 639313626 233101477 925352577 693432208 588108190 9 2 8 732654144 5 113144168 132630457 297387593

output:

871482275

result:

ok 1 number(s): "871482275"

Test #126:

score: 0
Accepted
time: 393ms
memory: 35920kb

input:

22
677485566 259899566 10 903363823 655220695 758024860 2 20 6 185059567 211401033 498132638 385103894 124607613 17 602133434 658188644 696230135 467144256 14 2 304053999

output:

57794836

result:

ok 1 number(s): "57794836"

Test #127:

score: 0
Accepted
time: 401ms
memory: 35996kb

input:

22
671127765 393165106 405462350 376126832 491730364 387132308 16 16 284947534 10 20 368027381 11 163090882 135629628 151084463 419592386 1 864207200 788619650 3 7

output:

718091323

result:

ok 1 number(s): "718091323"

Test #128:

score: 0
Accepted
time: 362ms
memory: 35996kb

input:

22
606207395 11 842111531 498774077 4 8 18 1 790712681 518528452 842066180 563411746 13 172422933 10 782966390 773592474 395002785 687034834 6 105285542 18

output:

215815586

result:

ok 1 number(s): "215815586"

Test #129:

score: 0
Accepted
time: 377ms
memory: 35956kb

input:

22
17 201091887 414961101 16 17 959735094 7 16 19 9 15 768888792 611840668 933784586 132436746 446503639 922200081 597631775 760959679 285114961 10 5

output:

375642605

result:

ok 1 number(s): "375642605"

Test #130:

score: 0
Accepted
time: 370ms
memory: 35996kb

input:

22
11 302478692 639115050 987433059 416989514 5 5 19 104877999 471185795 667443418 471836240 14 1 5 9 123708475 983343213 5 665739969 12 7

output:

360206597

result:

ok 1 number(s): "360206597"

Test #131:

score: 0
Accepted
time: 393ms
memory: 35920kb

input:

22
14 591563179 8 486077977 2 7 758861738 683350487 811235734 16 2 981499342 15 20 4 187681857 162113788 477234342 9 15 876963549 19

output:

477598456

result:

ok 1 number(s): "477598456"

Test #132:

score: 0
Accepted
time: 393ms
memory: 35988kb

input:

22
945563267 3 760519991 5 14 945602519 163272615 7 19 16 1 18 15 16 579260552 867035626 739332405 8 12 218033360 6 699257557

output:

787042584

result:

ok 1 number(s): "787042584"

Test #133:

score: 0
Accepted
time: 401ms
memory: 36008kb

input:

22
20 14 385002012 10 227245996 7 11 15 6 938371369 4 4 985038306 246125306 3 692978687 15 9 108579958 10 1 561869618

output:

713506666

result:

ok 1 number(s): "713506666"

Test #134:

score: 0
Accepted
time: 406ms
memory: 35968kb

input:

22
17 15 925145956 20 10 7 3 1 3 4 16 345086234 465294043 14 3 202836754 329519737 17 519368797 146978775 17 9

output:

632576201

result:

ok 1 number(s): "632576201"

Test #135:

score: 0
Accepted
time: 402ms
memory: 35964kb

input:

22
14 19 16 13 5 9 266810136 7 5 6 1 345426806 5 704166605 999426905 858768292 19 6 490664760 16 7 7

output:

174071277

result:

ok 1 number(s): "174071277"

Test #136:

score: 0
Accepted
time: 378ms
memory: 36000kb

input:

22
3 8 1 189771921 18 535816227 654749209 3 17 298167785 1 453426992 15 14 13 18 6 16 11 7 12 10

output:

292876553

result:

ok 1 number(s): "292876553"

Test #137:

score: 0
Accepted
time: 405ms
memory: 35976kb

input:

22
8 15 12 670656278 7 20 432534570 15 9 16 16 13 5 16 868792570 306374275 10 13 10 1 15 10

output:

288694679

result:

ok 1 number(s): "288694679"

Test #138:

score: 0
Accepted
time: 415ms
memory: 35960kb

input:

22
18 16 9 647813219 16 9 6 12 9 18 15 6 18 1 780413075 3 8 13 17 891596057 3 11

output:

430842549

result:

ok 1 number(s): "430842549"

Test #139:

score: 0
Accepted
time: 394ms
memory: 35996kb

input:

22
7 12 17 13 16 20 589100504 681490031 4 10 9 9 13 9 2 9 15 15 13 10 19 12

output:

872714864

result:

ok 1 number(s): "872714864"