QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#76449#5464. Dice GamemaspyAC ✓21ms3456kbC++2021.6kb2023-02-10 02:49:162023-02-10 02:49:19

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-10 02:49:19]
  • 评测
  • 测评结果:AC
  • 用时:21ms
  • 内存:3456kb
  • [2023-02-10 02:49:16]
  • 提交

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) {
  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 2 "library/mod/modint.hpp"

template <int mod>
struct modint {
  int val;
  constexpr modint(ll x = 0) noexcept {
    if (0 <= x && x < mod)
      val = x;
    else {
      x %= mod;
      val = (x < 0 ? x + mod : x);
    }
  }
  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(int64_t n) const {
    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() {
    ll x;
    fastio::scanner.read(x);
    if (x < 0 || x >= mod) x %= mod;
    if (x < 0) x += mod;
    val += x;
  }
#endif
  static constexpr int get_mod() { return mod; }
};

struct ArbitraryModInt {
  static constexpr bool is_modint = true;
  int val;
  ArbitraryModInt() : val(0) {}
  ArbitraryModInt(int64_t y)
      : val(y >= 0 ? y % get_mod()
                   : (get_mod() - (-y) % get_mod()) % get_mod()) {}
  bool operator<(const ArbitraryModInt &other) const {
    return val < other.val;
  } // To use std::map<ArbitraryModInt, T>
  static int &get_mod() {
    static int mod = 0;
    return mod;
  }
  static void set_mod(int md) { get_mod() = md; }
  ArbitraryModInt &operator+=(const ArbitraryModInt &p) {
    if ((val += p.val) >= get_mod()) val -= get_mod();
    return *this;
  }
  ArbitraryModInt &operator-=(const ArbitraryModInt &p) {
    if ((val += get_mod() - p.val) >= get_mod()) val -= get_mod();
    return *this;
  }
  ArbitraryModInt &operator*=(const ArbitraryModInt &p) {
    long long a = (long long)val * p.val;
    int xh = (int)(a >> 32), xl = (int)a, d, m;
    asm("divl %4; \n\t" : "=a"(d), "=d"(m) : "d"(xh), "a"(xl), "r"(get_mod()));
    val = m;
    return *this;
  }
  ArbitraryModInt &operator/=(const ArbitraryModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ArbitraryModInt operator-() const { return ArbitraryModInt(get_mod() - val); }
  ArbitraryModInt operator+(const ArbitraryModInt &p) const {
    return ArbitraryModInt(*this) += p;
  }
  ArbitraryModInt operator-(const ArbitraryModInt &p) const {
    return ArbitraryModInt(*this) -= p;
  }
  ArbitraryModInt operator*(const ArbitraryModInt &p) const {
    return ArbitraryModInt(*this) *= p;
  }
  ArbitraryModInt operator/(const ArbitraryModInt &p) const {
    return ArbitraryModInt(*this) /= p;
  }
  bool operator==(const ArbitraryModInt &p) const { return val == p.val; }
  bool operator!=(const ArbitraryModInt &p) const { return val != p.val; }
  ArbitraryModInt inverse() const {
    int a = val, b = get_mod(), u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b), swap(u -= t * v, v);
    }
    return ArbitraryModInt(u);
  }
  ArbitraryModInt pow(int64_t n) const {
    ArbitraryModInt 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
};

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 (int(dat.size()) <= n) {
    int k = dat.size();
    auto q = (mod + k - 1) / k;
    int r = k * q - mod;
    dat.emplace_back(dat[r] * mint(q));
  }
  return dat[n];
}

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

template <typename mint>
mint fact_inv(int n) {
  static const int mod = mint::get_mod();
  static vector<mint> dat = {1, 1};
  assert(-1 <= n && n < mod);
  if (n == -1) return mint(0);
  while (int(dat.size()) <= n) {
    int k = dat.size();
    dat.emplace_back(dat[k - 1] * inv<mint>(k));
  }
  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 fact<mint>(n) * fact_inv<mint>(k) * fact_inv<mint>(n - k);
  k = min(k, n - k);
  mint x(1);
  FOR(i, k) { x *= mint(n - i); }
  x *= fact_inv<mint>(k);
  return x;
}

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);
}

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

using mint = modint998;

void solve() {
  mint ANS = 0;
  LL(N);
  ANS += mint(N) * mint(N * (N - 1) / 2);
  const int K = 30;
  vi CF(K);
  FOR(k, K) {
    auto [q, r] = divmod(N, 1 << (1 + k));
    CF[k] += q * (1 << k);
    CF[k] += max<ll>(0, r - (1 << k));
    CF[k] <<= k + 1;
  }

  vi CFc = cumsum<ll>(CF);

  // sm_[0,N) s -
  auto dfs = [&](auto& dfs, ll n, ll k, ll s) -> mint {
    if (n == 0) return 0;
    if (s <= 0) return 0;
    assert(n <= (1 << k));
    if (k == 0) return s;
    if (n <= (1 << (k - 1))) { return dfs(dfs, n, k - 1, s); }

    mint res = 0;

    if (n == (1 << k) && CFc[k] <= s) {
      // 全部引いても 0 以上
      res += mint(s) * n;
      res -= mint(CFc[k]) * (n / 2);
      return res;
    } else {
      res += dfs(dfs, 1 << (k - 1), k - 1, s);
      res += dfs(dfs, n - (1 << (k - 1)), k - 1, s - CF[k - 1]);
    }
    /*
    FOR(x, n) {
      ll a = s;
      FOR(i, k) if (x & 1 << i) a -= CF[i];
      res += max<ll>(a, 0);
    }
    */
    return res;
  };

  ANS += dfs(dfs, N, K, N * (N - 1) / 2);

  print(ANS / mint(N * N));
  flush();
}

signed main() {
  INT(T);
  FOR(T) solve();
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3424kb

input:

4
1
2
3
4

output:

0
249561089
776412276
2

result:

ok 4 number(s): "0 249561089 776412276 2"

Test #2:

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

input:

100
119
75
29
10
17
29
449
71
72
12
79
117
83
80
35
272
105
497
346
287
362
140
297
167
111
419
210
212
170
413
373
210
196
39
1
101
258
496
333
293
392
2
187
431
157
342
436
106
449
136
378
243
357
325
237
254
22
292
62
435
18
446
471
18
42
377
181
350
19
389
212
58
45
70
52
63
107
71
66
355
381
30...

output:

645006489
296012775
400009943
299473312
221064504
400009943
60548260
896063466
573066250
471393174
175624519
531171954
143020402
134763040
560646647
43176836
269095960
284396636
191400715
895243672
967774080
745220060
584864173
5941827
724073586
701650152
262576881
417830609
833275086
916357319
1435...

result:

ok 100 numbers

Test #3:

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

input:

10
321
4212
2977
3438
679
2518
3359
2348
861
1853

output:

115992677
210903174
216412050
780704799
956649209
200804004
267658252
194263892
880330717
328032438

result:

ok 10 numbers

Test #4:

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

input:

12
3324
3167
3780
2887
1541
494
4374
3416
4036
3637
3888
4630

output:

458228110
29999980
333283438
544178470
753289945
257353919
515561689
628492255
799560584
924311157
17047279
109086825

result:

ok 12 numbers

Test #5:

score: 0
Accepted
time: 18ms
memory: 3396kb

input:

10000
11424730
231352165
835903988
101946284
358678826
610737477
100503274
909725926
510714513
407317433
668332866
442951503
582321912
117772499
180141789
570384258
375362779
724696666
959258227
178470161
245672142
629464136
515375633
58812672
119047157
272587596
993112981
678095944
67996298
2717673...

output:

773455292
683434339
654770591
108776362
54030504
758238038
436233322
26983313
618528269
242786531
282588800
601195176
822091665
44977640
13185362
944414915
982594059
59081478
811991891
805013315
411355069
258896281
387318839
364150538
743759092
219610191
735893626
206870034
888620825
243471456
86585...

result:

ok 10000 numbers

Test #6:

score: 0
Accepted
time: 18ms
memory: 3216kb

input:

9999
475321089
746229754
979860040
670737837
851205809
313824388
97186393
349885700
377965288
370823034
221464801
493667702
332030010
841211513
420009519
810273773
734562386
134199380
746229990
590968260
539384941
650715026
348914816
691577677
856753118
883582190
578525126
411136589
91382408
3872506...

output:

162058309
582357759
745415498
48044032
594126178
907349995
933767977
369531340
662347074
576247326
47032956
269920917
61871814
254264081
800032428
479150688
517127253
585160873
61225626
777523914
738993526
743910299
290327625
362567882
119425805
273147763
889983397
73132308
510579515
325651401
29452...

result:

ok 9999 numbers

Test #7:

score: 0
Accepted
time: 15ms
memory: 3448kb

input:

9998
270003016
898902417
753134541
920905814
749422440
528378358
272792638
798652367
926762221
240333165
688685959
840669484
685856990
290178850
605285377
940828219
472950279
12541860
171369994
854906988
54554998
340125033
922297475
808163672
155363071
20664647
332933456
288449335
260206009
83293465...

output:

445113060
648467803
567138888
893500881
353814151
881107902
812863586
318349033
835689922
745659312
516096163
691344408
502650393
546363158
468381470
799235062
26893141
728640551
590970088
431376130
605699235
700829815
962423286
875314311
811497551
272775004
900932046
656266015
226614432
278051834
4...

result:

ok 9998 numbers

Test #8:

score: 0
Accepted
time: 10ms
memory: 3268kb

input:

10000
7004865
547730684
900515935
981244725
402561120
421515755
406332037
469472200
812236994
734735141
582604684
930572748
539955629
457322973
187092673
426473013
134298242
637099606
820930467
61556598
268821615
553863531
637421936
636971416
910875132
258323021
649381916
940405500
145206370
1226633...

output:

727082382
950007807
517669549
147031734
295209626
682040827
526246006
105459816
333924563
694448221
277317233
124028938
888780055
913334748
480689156
641455528
132519371
228438757
612904796
309545299
637339129
369652521
296192649
477539092
241522777
353196088
294958205
455704279
531666996
351869449
...

result:

ok 10000 numbers

Test #9:

score: 0
Accepted
time: 19ms
memory: 3352kb

input:

9999
375389244
853081948
214303450
624288451
164998393
803104757
279292248
912349766
982249747
734644502
872303168
17514112
667075135
355197053
554706104
709185140
415001652
49281827
945717388
637523993
116279583
88634397
212437542
512565341
358646240
24335958
382985215
494593754
236874166
179411063...

output:

348598038
950244966
113861493
742824419
519918299
760998798
821856474
479929543
118792294
486041337
958491940
172551381
810354334
78585119
675171275
683641670
978798892
992232582
296795246
506314128
485104664
591324715
726632388
900784223
887777114
59055662
921028016
112301949
93378506
812251419
678...

result:

ok 9999 numbers

Test #10:

score: 0
Accepted
time: 14ms
memory: 3376kb

input:

9998
816188381
777680392
465615266
905983947
327401081
897460908
345832367
733636910
119451020
35289897
688224481
158777509
677408436
228537232
5013477
937725296
646960559
218240521
737427947
518752966
780510774
808963543
23124184
469503100
137709950
671491009
753918793
453459452
859297030
520589626...

output:

843316453
487733752
714614955
644157927
215313566
12730877
491899455
834904220
589939748
705018270
986843757
5877175
624017832
250380910
322346924
321639266
448686114
685130377
49828938
355577594
508006740
991388088
478861872
750268205
562792124
424225933
289859108
398514543
543424709
850460804
4899...

result:

ok 9998 numbers

Test #11:

score: 0
Accepted
time: 14ms
memory: 3356kb

input:

10000
336455907
884795238
268414386
529784692
880855011
174937959
722107317
103205959
476573
684511018
56843859
906282583
848096428
341574327
707316873
538523982
851430658
820986882
638018634
557656621
935828709
48955448
644847154
745551022
982517823
401077434
77365587
117332965
723303038
25103854
5...

output:

935655597
111544535
713169488
181987967
486574323
628830867
162112583
230643752
288923673
634183679
415675798
790288926
757275082
593278518
593537831
374254675
124057917
811297567
105600773
735779080
546409362
310457849
397830775
569434914
834255768
772726602
316012369
398872485
78996805
868500544
1...

result:

ok 10000 numbers

Test #12:

score: 0
Accepted
time: 15ms
memory: 3272kb

input:

9999
652452834
512746423
217578275
290812693
505985481
708074702
140084628
715623044
178983119
637374575
831918318
699544382
395566211
889019810
164877759
688304705
707774421
984064748
606126349
935297725
169450953
593901879
370836445
278217787
96094628
225589992
236002775
19400437
190337201
3684967...

output:

569480432
101978386
20882035
485508806
341574182
938886298
492435823
361752244
406169082
159153032
862715685
787115736
303885500
37673860
324907578
5425483
796634564
175580456
612102344
935244673
586348956
89355115
749079617
443965402
854260850
209520959
412627807
823945330
975724416
301536807
79121...

result:

ok 9999 numbers

Test #13:

score: 0
Accepted
time: 18ms
memory: 3272kb

input:

9998
583685085
554162690
322146148
712486698
252545896
685323264
97417085
991444340
87697056
693383934
591583265
616117253
662389178
388907218
506341818
602178731
10449401
306491696
618794569
185764033
985608413
348253473
79812072
844611890
798074046
840545413
728159186
805348612
559472666
598701969...

output:

630787213
770486178
942483055
79103212
221174109
873542047
592480667
281386892
645191968
140712701
227021387
542656
750012303
677867460
67350280
986441490
396852178
38557658
549458345
400881583
473221591
314310077
120596778
140712743
139050597
618331646
822861337
947480530
578072062
978471526
242850...

result:

ok 9998 numbers

Test #14:

score: 0
Accepted
time: 13ms
memory: 3356kb

input:

10000
722522957
165847267
600139674
75505128
469888668
206896531
492504096
835505843
467233005
683114943
153620953
954492050
427421953
36631655
893573032
318369978
592286683
921741950
394356591
658376694
520007414
701498064
849187101
912223605
466269253
28062575
530477087
686061218
723441825
8532052...

output:

522321543
454408068
43367845
501001379
907415860
448387126
340434891
841443488
840323173
458062454
384076670
244906877
927352129
23999703
557225442
785525852
812399817
615519957
218401439
569219268
54626550
921149174
846942151
270972482
641280214
113070498
889688758
4896446
275316235
326989485
68532...

result:

ok 10000 numbers

Test #15:

score: 0
Accepted
time: 19ms
memory: 3208kb

input:

10000
989304703
954865905
340362980
44321332
344612580
807556757
901881018
234818639
138196638
706932569
742765586
243741272
209533564
818504148
957242356
483748398
40004575
129674449
806264636
361499944
105327677
686168399
704697241
907735692
54776864
559627136
570524943
381528089
730391461
7273480...

output:

169048019
974976374
746872254
807664053
167779779
263663928
363570928
737029108
870544100
773515719
755126121
30154878
357290239
469801714
343766962
65559064
323789467
2826898
697929012
255294849
717503755
244053335
266680291
898255213
199673574
544002394
955104432
203670699
786411387
525680717
4280...

result:

ok 10000 numbers

Test #16:

score: 0
Accepted
time: 10ms
memory: 3392kb

input:

10000
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
10...

output:

0
249561089
776412276
2
399297744
55458023
305585010
499122181
258804097
299473312
107249400
471393174
667465167
112047844
483593940
499122186
221064504
18486018
851687715
99824448
894119105
713620977
747267999
873463824
78262373
271711497
696990930
723217865
400009943
468065704
820617125
499122196
...

result:

ok 10000 numbers

Test #17:

score: 0
Accepted
time: 12ms
memory: 3216kb

input:

10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
...

output:

502306237
864137539
176436977
739262005
846985790
688488686
417094811
510634895
758668232
169847740
577531603
527599619
663102981
448564810
463720873
325965395
91749627
135891716
472142360
528150916
772849920
155883396
349289558
477015777
727830746
437044606
514725392
644321169
420306621
108741781
2...

result:

ok 10000 numbers

Test #18:

score: 0
Accepted
time: 12ms
memory: 3224kb

input:

10000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
...

output:

106549574
180829667
473014026
230908549
287497262
976111546
271774809
144446422
531973297
196605051
605420236
877855196
565729314
556720102
816842137
522147614
342128645
19969935
155261407
464039069
179275242
655941030
177254284
556077062
888147239
450958620
624467404
722425190
916563118
428319570
8...

result:

ok 10000 numbers

Test #19:

score: 0
Accepted
time: 11ms
memory: 3208kb

input:

10000
30001
30002
30003
30004
30005
30006
30007
30008
30009
30010
30011
30012
30013
30014
30015
30016
30017
30018
30019
30020
30021
30022
30023
30024
30025
30026
30027
30028
30029
30030
30031
30032
30033
30034
30035
30036
30037
30038
30039
30040
30041
30042
30043
30044
30045
30046
30047
30048
30049
...

output:

93713006
659412951
225820873
770939997
831597836
52588861
389955014
815442206
544947417
744137472
339440572
210414884
257952840
337138358
305799522
204131848
445881560
242448084
221704852
183775660
752969971
205107596
400609556
369761246
4417471
529289765
661139010
711384747
763185973
374418198
2781...

result:

ok 10000 numbers

Test #20:

score: 0
Accepted
time: 8ms
memory: 3444kb

input:

10000
40001
40002
40003
40004
40005
40006
40007
40008
40009
40010
40011
40012
40013
40014
40015
40016
40017
40018
40019
40020
40021
40022
40023
40024
40025
40026
40027
40028
40029
40030
40031
40032
40033
40034
40035
40036
40037
40038
40039
40040
40041
40042
40043
40044
40045
40046
40047
40048
40049
...

output:

481999301
712221325
441007702
175706650
896431011
291280067
443031640
960939275
203653013
75872348
600441352
958735443
669744549
44427442
176552318
788015021
165042826
801706408
881488083
892332279
379869001
711718296
227326177
945700506
132886493
299431287
133009079
614318028
120810427
8326627
1654...

result:

ok 10000 numbers

Test #21:

score: 0
Accepted
time: 12ms
memory: 3352kb

input:

10000
50001
50002
50003
50004
50005
50006
50007
50008
50009
50010
50011
50012
50013
50014
50015
50016
50017
50018
50019
50020
50021
50022
50023
50024
50025
50026
50027
50028
50029
50030
50031
50032
50033
50034
50035
50036
50037
50038
50039
50040
50041
50042
50043
50044
50045
50046
50047
50048
50049
...

output:

971941436
407489605
958312341
961962482
146967225
925491543
139381156
480270839
201548983
349550207
752468405
267592198
645186661
30131366
754673755
618847274
805333597
100858427
394658709
868258319
698251979
820758765
281909330
483432275
823878382
573064282
102857163
188998401
159758423
349581955
6...

result:

ok 10000 numbers

Test #22:

score: 0
Accepted
time: 7ms
memory: 3300kb

input:

10000
60001
60002
60003
60004
60005
60006
60007
60008
60009
60010
60011
60012
60013
60014
60015
60016
60017
60018
60019
60020
60021
60022
60023
60024
60025
60026
60027
60028
60029
60030
60031
60032
60033
60034
60035
60036
60037
60038
60039
60040
60041
60042
60043
60044
60045
60046
60047
60048
60049
...

output:

567692531
274518926
162808710
153476030
279793346
699027413
498607119
60496962
970105482
327759507
922512192
582488355
588008267
280787852
269887193
133517883
911725038
590772658
857129489
989152768
738973784
179758968
664053084
841065374
464837304
389912848
872609192
303683602
340996049
866058742
3...

result:

ok 10000 numbers

Test #23:

score: 0
Accepted
time: 12ms
memory: 3344kb

input:

10000
70001
70002
70003
70004
70005
70006
70007
70008
70009
70010
70011
70012
70013
70014
70015
70016
70017
70018
70019
70020
70021
70022
70023
70024
70025
70026
70027
70028
70029
70030
70031
70032
70033
70034
70035
70036
70037
70038
70039
70040
70041
70042
70043
70044
70045
70046
70047
70048
70049
...

output:

870401672
552027428
421077940
36504834
222589409
793714664
633915969
877145399
499670082
66260470
964461580
849715237
412789569
396320160
2575010
677253671
369373109
55093630
535398191
997276819
263169989
678306904
870152849
193607081
661960972
783749215
286630814
669290046
441559532
707408828
28946...

result:

ok 10000 numbers

Test #24:

score: 0
Accepted
time: 9ms
memory: 3300kb

input:

10000
80001
80002
80003
80004
80005
80006
80007
80008
80009
80010
80011
80012
80013
80014
80015
80016
80017
80018
80019
80020
80021
80022
80023
80024
80025
80026
80027
80028
80029
80030
80031
80032
80033
80034
80035
80036
80037
80038
80039
80040
80041
80042
80043
80044
80045
80046
80047
80048
80049
...

output:

502268612
269518394
599112330
925320474
943257502
305333238
47559735
32498239
547255032
295495493
346396457
159359672
347986985
400943983
230477237
424512021
667459585
906428203
227049897
316811922
954622010
701760528
273105995
420104357
658806353
74550891
193397946
478572437
417769469
852226813
551...

result:

ok 10000 numbers

Test #25:

score: 0
Accepted
time: 12ms
memory: 3392kb

input:

10000
90001
90002
90003
90004
90005
90006
90007
90008
90009
90010
90011
90012
90013
90014
90015
90016
90017
90018
90019
90020
90021
90022
90023
90024
90025
90026
90027
90028
90029
90030
90031
90032
90033
90034
90035
90036
90037
90038
90039
90040
90041
90042
90043
90044
90045
90046
90047
90048
90049
...

output:

12147913
499838266
742901604
522806074
993984194
488759621
726145861
904416835
400963499
697561121
42360598
257680356
431954271
845627914
276432403
593968277
517314186
776338218
541919461
168667668
89586940
189595125
888816478
198018657
619845709
467010146
851346459
675747826
389237512
510075735
446...

result:

ok 10000 numbers

Test #26:

score: 0
Accepted
time: 8ms
memory: 3224kb

input:

10000
100001
100002
100003
100004
100005
100006
100007
100008
100009
100010
100011
100012
100013
100014
100015
100016
100017
100018
100019
100020
100021
100022
100023
100024
100025
100026
100027
100028
100029
100030
100031
100032
100033
100034
100035
100036
100037
100038
100039
100040
100041
100042
...

output:

508995172
446516343
366722373
315857034
966974221
127929388
96114431
426558435
431099349
793056627
505646394
430859565
113998284
155203212
777942951
461419502
582010567
248645456
150918409
927309100
847941028
7570281
835963823
100374171
526573546
599886602
861306162
559384909
285118877
359507533
705...

result:

ok 10000 numbers

Test #27:

score: 0
Accepted
time: 12ms
memory: 3224kb

input:

10000
110001
110002
110003
110004
110005
110006
110007
110008
110009
110010
110011
110012
110013
110014
110015
110016
110017
110018
110019
110020
110021
110022
110023
110024
110025
110026
110027
110028
110029
110030
110031
110032
110033
110034
110035
110036
110037
110038
110039
110040
110041
110042
...

output:

647622062
203305411
937441561
811327892
960423136
603966427
805085649
599227785
149193041
612849147
973512566
320394126
217528269
211415915
710277032
702817984
274796331
590766317
908891704
233744195
622255149
356435063
679446786
570404142
485285631
762500483
703756637
141423859
852553462
839092155
...

result:

ok 10000 numbers

Test #28:

score: 0
Accepted
time: 12ms
memory: 3272kb

input:

10000
120001
120002
120003
120004
120005
120006
120007
120008
120009
120010
120011
120012
120013
120014
120015
120016
120017
120018
120019
120020
120021
120022
120023
120024
120025
120026
120027
120028
120029
120030
120031
120032
120033
120034
120035
120036
120037
120038
120039
120040
120041
120042
...

output:

11704701
497447804
154810860
707729462
527724868
33829678
473683602
322658961
663647686
60464516
657317503
898932650
443634744
498092062
608613592
620116101
853498783
442844435
945065017
151688712
158497950
979320988
943848951
532827753
305763879
975173829
90861717
911524972
148948181
40652210
46542...

result:

ok 10000 numbers

Test #29:

score: 0
Accepted
time: 11ms
memory: 3212kb

input:

10000
130001
130002
130003
130004
130005
130006
130007
130008
130009
130010
130011
130012
130013
130014
130015
130016
130017
130018
130019
130020
130021
130022
130023
130024
130025
130026
130027
130028
130029
130030
130031
130032
130033
130034
130035
130036
130037
130038
130039
130040
130041
130042
...

output:

947325080
628656807
345050792
442247418
987230987
744438386
260213095
720823277
579972844
982651713
382583046
266992847
985103605
801499230
912957955
726692290
97012784
868609107
719301855
231947540
429369969
714349075
288760128
161493395
362128227
283384637
425074623
216188565
422379369
260723970
7...

result:

ok 10000 numbers

Test #30:

score: 0
Accepted
time: 13ms
memory: 3264kb

input:

10000
140001
140002
140003
140004
140005
140006
140007
140008
140009
140010
140011
140012
140013
140014
140015
140016
140017
140018
140019
140020
140021
140022
140023
140024
140025
140026
140027
140028
140029
140030
140031
140032
140033
140034
140035
140036
140037
140038
140039
140040
140041
140042
...

output:

768039129
646500616
630456793
86531808
554258207
343033704
240684216
572131845
151650135
944300995
802397015
90062799
967108978
80043025
545820522
669579936
815877609
427471108
37651432
901430951
967617725
431556631
190817616
202063945
621248764
326456962
954954698
293518144
937881112
505067382
8456...

result:

ok 10000 numbers

Test #31:

score: 0
Accepted
time: 13ms
memory: 3280kb

input:

10000
150001
150002
150003
150004
150005
150006
150007
150008
150009
150010
150011
150012
150013
150014
150015
150016
150017
150018
150019
150020
150021
150022
150023
150024
150025
150026
150027
150028
150029
150030
150031
150032
150033
150034
150035
150036
150037
150038
150039
150040
150041
150042
...

output:

2849379
441253129
5971909
601631441
303048294
505276110
984069214
729368993
640366835
4649093
476609970
263283487
91859628
302629111
783530590
855120456
922805215
276972312
949497387
201422699
395440668
977524762
261176556
474193801
385551480
781968738
324991557
500301891
599841122
780452047
1964030...

result:

ok 10000 numbers

Test #32:

score: 0
Accepted
time: 13ms
memory: 3340kb

input:

10000
160001
160002
160003
160004
160005
160006
160007
160008
160009
160010
160011
160012
160013
160014
160015
160016
160017
160018
160019
160020
160021
160022
160023
160024
160025
160026
160027
160028
160029
160030
160031
160032
160033
160034
160035
160036
160037
160038
160039
160040
160041
160042
...

output:

858862177
505415048
567639711
449936606
818679845
313112626
527287879
353274419
904301852
327539861
881727880
414737384
405779775
594241647
647679791
131477667
82828592
731683512
816267012
91868810
585899065
193670738
555266192
202945583
846703410
196851794
339336192
302765790
586307308
192684420
41...

result:

ok 10000 numbers

Test #33:

score: 0
Accepted
time: 8ms
memory: 3352kb

input:

10000
170001
170002
170003
170004
170005
170006
170007
170008
170009
170010
170011
170012
170013
170014
170015
170016
170017
170018
170019
170020
170021
170022
170023
170024
170025
170026
170027
170028
170029
170030
170031
170032
170033
170034
170035
170036
170037
170038
170039
170040
170041
170042
...

output:

833924799
174623791
58439462
873713856
365974903
135721017
885410676
156034981
271551048
749662716
300040239
713851292
282495170
562457374
609703500
623426087
66105584
941556274
43875613
970272089
128784180
425177817
629766000
484556931
494970400
140430192
892497016
494199866
574261388
566230234
341...

result:

ok 10000 numbers

Test #34:

score: 0
Accepted
time: 13ms
memory: 3340kb

input:

10000
180001
180002
180003
180004
180005
180006
180007
180008
180009
180010
180011
180012
180013
180014
180015
180016
180017
180018
180019
180020
180021
180022
180023
180024
180025
180026
180027
180028
180029
180030
180031
180032
180033
180034
180035
180036
180037
180038
180039
180040
180041
180042
...

output:

789964370
523418003
288914088
960444086
107356464
986681032
280141973
271629353
454271712
490601859
828386013
519885551
764159675
953169546
916372892
934904482
849350274
302804822
428512273
652650422
189486013
583843373
817226638
604132168
601676728
364786366
762137484
183879937
487722895
53742630
1...

result:

ok 10000 numbers

Test #35:

score: 0
Accepted
time: 12ms
memory: 3268kb

input:

10000
190001
190002
190003
190004
190005
190006
190007
190008
190009
190010
190011
190012
190013
190014
190015
190016
190017
190018
190019
190020
190021
190022
190023
190024
190025
190026
190027
190028
190029
190030
190031
190032
190033
190034
190035
190036
190037
190038
190039
190040
190041
190042
...

output:

73028808
84834845
716307966
37780165
994050215
449341702
689220749
673974966
635636250
43167525
744597843
195388147
579159654
634839625
990848545
541118130
532762548
569640803
181019690
171160292
569713563
57751741
138002576
545136228
875542646
193414841
514934079
419233457
181757317
515653336
51702...

result:

ok 10000 numbers

Test #36:

score: 0
Accepted
time: 6ms
memory: 3292kb

input:

10000
200001
200002
200003
200004
200005
200006
200007
200008
200009
200010
200011
200012
200013
200014
200015
200016
200017
200018
200019
200020
200021
200022
200023
200024
200025
200026
200027
200028
200029
200030
200031
200032
200033
200034
200035
200036
200037
200038
200039
200040
200041
200042
...

output:

354409442
105334123
918424416
985710190
935921822
234322570
912231195
834852558
461445820
735695116
153461045
754980953
612252374
691351039
187503777
597350149
526009841
363076522
568877101
88746725
337021868
362117414
612369849
362596954
541781078
727118745
559470621
625337114
503814111
58519373
54...

result:

ok 10000 numbers

Test #37:

score: 0
Accepted
time: 9ms
memory: 3396kb

input:

10000
210001
210002
210003
210004
210005
210006
210007
210008
210009
210010
210011
210012
210013
210014
210015
210016
210017
210018
210019
210020
210021
210022
210023
210024
210025
210026
210027
210028
210029
210030
210031
210032
210033
210034
210035
210036
210037
210038
210039
210040
210041
210042
...

output:

344795476
615608073
948317442
548060015
556172416
441978372
287008841
271225048
436103986
569205556
860144678
180437216
80978322
399704244
569993136
787224464
701720477
196311876
26507064
851429493
785945017
528528851
812710619
754511870
519545236
714159969
517416508
677071233
634207219
476082404
40...

result:

ok 10000 numbers

Test #38:

score: 0
Accepted
time: 12ms
memory: 3224kb

input:

10000
220001
220002
220003
220004
220005
220006
220007
220008
220009
220010
220011
220012
220013
220014
220015
220016
220017
220018
220019
220020
220021
220022
220023
220024
220025
220026
220027
220028
220029
220030
220031
220032
220033
220034
220035
220036
220037
220038
220039
220040
220041
220042
...

output:

996210057
796121948
321070637
165773446
159439090
336967601
91654024
907959802
757637847
423479743
456384976
708810678
346055311
424469563
561610708
843052402
320605767
797508259
202479637
726576118
34423582
449658603
726820663
264340205
407784012
423527514
291334616
921954007
955557756
921431888
84...

result:

ok 10000 numbers

Test #39:

score: 0
Accepted
time: 10ms
memory: 3372kb

input:

10000
230001
230002
230003
230004
230005
230006
230007
230008
230009
230010
230011
230012
230013
230014
230015
230016
230017
230018
230019
230020
230021
230022
230023
230024
230025
230026
230027
230028
230029
230030
230031
230032
230033
230034
230035
230036
230037
230038
230039
230040
230041
230042
...

output:

614360330
944080806
743391907
167018605
793910924
180932848
342651475
509103968
453797183
746460070
234805996
220632736
199943053
600017486
543649972
709797439
970057572
201806450
33242066
552556185
257549856
858802726
929586109
940350203
169716688
764935444
590641487
910942924
68998825
939666329
93...

result:

ok 10000 numbers

Test #40:

score: 0
Accepted
time: 7ms
memory: 3268kb

input:

10000
240001
240002
240003
240004
240005
240006
240007
240008
240009
240010
240011
240012
240013
240014
240015
240016
240017
240018
240019
240020
240021
240022
240023
240024
240025
240026
240027
240028
240029
240030
240031
240032
240033
240034
240035
240036
240037
240038
240039
240040
240041
240042
...

output:

804924425
522531579
675864921
495773432
279709659
808743897
770961103
916336748
755502477
556327560
453041574
601089178
171089025
136427221
366565089
54789536
749080058
422415914
133904232
818679991
564391649
815512830
777195180
300498771
934671808
388147312
676228255
497061948
361880232
718105008
8...

result:

ok 10000 numbers

Test #41:

score: 0
Accepted
time: 16ms
memory: 3352kb

input:

10000
250001
250002
250003
250004
250005
250006
250007
250008
250009
250010
250011
250012
250013
250014
250015
250016
250017
250018
250019
250020
250021
250022
250023
250024
250025
250026
250027
250028
250029
250030
250031
250032
250033
250034
250035
250036
250037
250038
250039
250040
250041
250042
...

output:

977611775
52072841
628892067
570316388
494323586
818429664
435698613
680085511
449359154
279957860
785681359
802345471
322266492
665308740
167215876
392670677
933819814
552583005
751641289
95347879
211189558
3597619
833170888
960212095
455094292
108753735
500048385
433821765
489621915
223483698
7569...

result:

ok 10000 numbers

Test #42:

score: 0
Accepted
time: 12ms
memory: 3304kb

input:

10000
260001
260002
260003
260004
260005
260006
260007
260008
260009
260010
260011
260012
260013
260014
260015
260016
260017
260018
260019
260020
260021
260022
260023
260024
260025
260026
260027
260028
260029
260030
260031
260032
260033
260034
260035
260036
260037
260038
260039
260040
260041
260042
...

output:

949751301
166220763
169877324
188904374
723561531
975223416
996168988
28234308
275556189
883110629
164920933
788721158
328293450
53682446
277877962
790857803
572488785
502014364
895292541
602902734
303233043
47689412
684036553
419785390
376592851
54944269
96695620
865750049
274666216
286849064
52798...

result:

ok 10000 numbers

Test #43:

score: 0
Accepted
time: 13ms
memory: 3336kb

input:

10000
270001
270002
270003
270004
270005
270006
270007
270008
270009
270010
270011
270012
270013
270014
270015
270016
270017
270018
270019
270020
270021
270022
270023
270024
270025
270026
270027
270028
270029
270030
270031
270032
270033
270034
270035
270036
270037
270038
270039
270040
270041
270042
...

output:

725285414
510694271
814982310
228827760
821706817
570340780
747615888
854113978
732925228
32832053
377756693
859639260
845437041
394132548
454303112
369320039
149271185
63859163
867871812
116940101
466577683
245038530
116483650
307663353
778773390
959252577
546248397
422463677
177897868
768416060
87...

result:

ok 10000 numbers

Test #44:

score: 0
Accepted
time: 12ms
memory: 3352kb

input:

10000
280001
280002
280003
280004
280005
280006
280007
280008
280009
280010
280011
280012
280013
280014
280015
280016
280017
280018
280019
280020
280021
280022
280023
280024
280025
280026
280027
280028
280029
280030
280031
280032
280033
280034
280035
280036
280037
280038
280039
280040
280041
280042
...

output:

349981405
38711729
93712359
793879056
393565209
310321443
244506425
126173080
248172578
670192402
612429100
667281628
629552895
980490609
376999058
645141514
562790418
802422447
82442240
391235461
240664559
221151717
457531224
767980361
130848004
761474238
32463697
633201692
51879879
592518868
15203...

result:

ok 10000 numbers

Test #45:

score: 0
Accepted
time: 14ms
memory: 3304kb

input:

10000
290001
290002
290003
290004
290005
290006
290007
290008
290009
290010
290011
290012
290013
290014
290015
290016
290017
290018
290019
290020
290021
290022
290023
290024
290025
290026
290027
290028
290029
290030
290031
290032
290033
290034
290035
290036
290037
290038
290039
290040
290041
290042
...

output:

712392607
812540803
530014410
784204298
361860150
367689005
926729224
931605613
38365967
364350146
287221494
757625764
870298309
330875066
482626170
29709242
439034175
148809748
717168094
361371364
143712361
924041810
84808807
553524545
420498671
145550898
992891370
218063208
403560036
759793840
793...

result:

ok 10000 numbers

Test #46:

score: 0
Accepted
time: 4ms
memory: 3228kb

input:

10000
300001
300002
300003
300004
300005
300006
300007
300008
300009
300010
300011
300012
300013
300014
300015
300016
300017
300018
300019
300020
300021
300022
300023
300024
300025
300026
300027
300028
300029
300030
300031
300032
300033
300034
300035
300036
300037
300038
300039
300040
300041
300042
...

output:

535538746
504820935
595163398
383384082
190453361
351358039
232096465
763999844
85668979
106974412
320628992
511430044
295174797
851929163
289517970
415782061
378220703
781611494
782790298
508420363
44910928
63199790
855858379
789126784
408653888
682841433
408979115
106136046
702208165
716229328
297...

result:

ok 10000 numbers

Test #47:

score: 0
Accepted
time: 13ms
memory: 3268kb

input:

10000
310001
310002
310003
310004
310005
310006
310007
310008
310009
310010
310011
310012
310013
310014
310015
310016
310017
310018
310019
310020
310021
310022
310023
310024
310025
310026
310027
310028
310029
310030
310031
310032
310033
310034
310035
310036
310037
310038
310039
310040
310041
310042
...

output:

865651604
435749785
628221741
241218061
811352551
66629260
898000077
513912820
461266661
170920012
589406151
378586792
567505617
509058298
82644766
746566940
560845298
329927105
286520669
81911482
47026110
938517850
749722388
975331829
232983865
340028292
32641845
72265767
109796691
629172312
602846...

result:

ok 10000 numbers

Test #48:

score: 0
Accepted
time: 5ms
memory: 3372kb

input:

10000
320001
320002
320003
320004
320005
320006
320007
320008
320009
320010
320011
320012
320013
320014
320015
320016
320017
320018
320019
320020
320021
320022
320023
320024
320025
320026
320027
320028
320029
320030
320031
320032
320033
320034
320035
320036
320037
320038
320039
320040
320041
320042
...

output:

792496300
220357825
200736747
511707920
157158516
440931425
61945785
400751036
790238309
139993161
275339184
981337763
622895060
555453582
125822219
207426662
193507038
80447495
403132252
581439359
221372841
266089231
942570421
139976055
143734159
689070567
245364536
689361118
608327154
796237406
36...

result:

ok 10000 numbers

Test #49:

score: 0
Accepted
time: 14ms
memory: 3376kb

input:

10000
330001
330002
330003
330004
330005
330006
330007
330008
330009
330010
330011
330012
330013
330014
330015
330016
330017
330018
330019
330020
330021
330022
330023
330024
330025
330026
330027
330028
330029
330030
330031
330032
330033
330034
330035
330036
330037
330038
330039
330040
330041
330042
...

output:

505190139
71189833
485005396
262127284
321353002
871841691
478481965
130757683
101675598
932279259
517298296
97171445
483856328
409091812
327886453
525307526
157712270
865203467
881622971
115788132
404321992
237252057
449918942
863501825
437342500
622963798
500737184
789935305
672059499
109116482
27...

result:

ok 10000 numbers

Test #50:

score: 0
Accepted
time: 8ms
memory: 3372kb

input:

10000
340001
340002
340003
340004
340005
340006
340007
340008
340009
340010
340011
340012
340013
340014
340015
340016
340017
340018
340019
340020
340021
340022
340023
340024
340025
340026
340027
340028
340029
340030
340031
340032
340033
340034
340035
340036
340037
340038
340039
340040
340041
340042
...

output:

75798090
170483069
274647877
665090990
859432721
616001101
642001493
196429464
60273048
232827630
758352940
941107608
7364051
273454823
778300475
117743659
130486248
43979920
837936810
747897807
150055063
100958302
205208756
928580408
766729416
676061394
260988039
625792572
360160997
986785753
31976...

result:

ok 10000 numbers

Test #51:

score: 0
Accepted
time: 13ms
memory: 3228kb

input:

10000
350001
350002
350003
350004
350005
350006
350007
350008
350009
350010
350011
350012
350013
350014
350015
350016
350017
350018
350019
350020
350021
350022
350023
350024
350025
350026
350027
350028
350029
350030
350031
350032
350033
350034
350035
350036
350037
350038
350039
350040
350041
350042
...

output:

389259169
453228212
513274294
951822657
498245219
148420552
792530784
733290915
206060477
880643273
772520985
81062870
563684669
678458508
876008309
751623797
906481697
239539779
300686747
720925671
174590310
527445179
248065535
713415265
613599342
305478168
554431752
499878067
331636298
443142978
1...

result:

ok 10000 numbers

Test #52:

score: 0
Accepted
time: 13ms
memory: 3336kb

input:

10000
360001
360002
360003
360004
360005
360006
360007
360008
360009
360010
360011
360012
360013
360014
360015
360016
360017
360018
360019
360020
360021
360022
360023
360024
360025
360026
360027
360028
360029
360030
360031
360032
360033
360034
360035
360036
360037
360038
360039
360040
360041
360042
...

output:

752292772
814734770
397687913
547713830
531282660
12713660
889835681
423521643
721905666
439156580
324558648
475995535
838800875
850127712
632084803
44136530
727118611
494741182
244982603
482081542
257436064
17990969
814349871
540648926
639479545
332367496
370022708
408972563
809755446
418585967
685...

result:

ok 10000 numbers

Test #53:

score: 0
Accepted
time: 14ms
memory: 3376kb

input:

10000
370001
370002
370003
370004
370005
370006
370007
370008
370009
370010
370011
370012
370013
370014
370015
370016
370017
370018
370019
370020
370021
370022
370023
370024
370025
370026
370027
370028
370029
370030
370031
370032
370033
370034
370035
370036
370037
370038
370039
370040
370041
370042
...

output:

491352714
150432305
792005686
1696406
876809689
46720397
638344670
232451034
419552409
751773704
289739560
613621629
904580419
181776472
40579320
941745813
970910071
242350913
568535567
730589567
886296232
953839357
527305694
198322688
546380612
981172139
831374013
13191259
165989246
498158919
84269...

result:

ok 10000 numbers

Test #54:

score: 0
Accepted
time: 16ms
memory: 3396kb

input:

10000
380001
380002
380003
380004
380005
380006
380007
380008
380009
380010
380011
380012
380013
380014
380015
380016
380017
380018
380019
380020
380021
380022
380023
380024
380025
380026
380027
380028
380029
380030
380031
380032
380033
380034
380035
380036
380037
380038
380039
380040
380041
380042
...

output:

988109621
645179793
528815694
328910263
918679418
933493756
634130339
418505042
602472794
490733901
771157583
909575046
451637004
879319322
590747489
24205672
396284239
772150324
481098635
45876138
565542148
922060781
719844285
889898471
276044366
745557048
349646623
770557074
799389320
55603666
698...

result:

ok 10000 numbers

Test #55:

score: 0
Accepted
time: 16ms
memory: 3340kb

input:

10000
390001
390002
390003
390004
390005
390006
390007
390008
390009
390010
390011
390012
390013
390014
390015
390016
390017
390018
390019
390020
390021
390022
390023
390024
390025
390026
390027
390028
390029
390030
390031
390032
390033
390034
390035
390036
390037
390038
390039
390040
390041
390042
...

output:

232231972
55993577
336537339
235167890
642976660
651291419
438287392
49467265
826434900
415767664
413556142
106461392
195694517
705262246
356680423
130232877
277391669
349312534
188662759
992285446
335379570
197016771
538769188
115054336
546144314
843402557
270074145
897662992
756890776
879831184
35...

result:

ok 10000 numbers

Test #56:

score: 0
Accepted
time: 17ms
memory: 3264kb

input:

10000
400001
400002
400003
400004
400005
400006
400007
400008
400009
400010
400011
400012
400013
400014
400015
400016
400017
400018
400019
400020
400021
400022
400023
400024
400025
400026
400027
400028
400029
400030
400031
400032
400033
400034
400035
400036
400037
400038
400039
400040
400041
400042
...

output:

435197866
209696708
144643307
406959041
906088993
339482303
946951679
474053851
3568118
557313778
826425493
967767317
969597057
327095861
369846101
817651399
907992621
423769464
375514879
972268056
538757369
814518462
454991336
12595377
488098701
725382572
514195389
164975903
487605118
874129731
173...

result:

ok 10000 numbers

Test #57:

score: 0
Accepted
time: 13ms
memory: 3340kb

input:

10000
410001
410002
410003
410004
410005
410006
410007
410008
410009
410010
410011
410012
410013
410014
410015
410016
410017
410018
410019
410020
410021
410022
410023
410024
410025
410026
410027
410028
410029
410030
410031
410032
410033
410034
410035
410036
410037
410038
410039
410040
410041
410042
...

output:

450989102
603840245
474536492
180490022
30727911
162977284
826904122
578287674
183044951
601122920
312832871
330776661
537964429
225628134
774037485
410905548
8716951
296431129
80278625
416180384
561161703
556973184
941439512
140956537
652347926
140394568
899816042
715037236
8006239
564899211
480048...

result:

ok 10000 numbers

Test #58:

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

input:

10000
420001
420002
420003
420004
420005
420006
420007
420008
420009
420010
420011
420012
420013
420014
420015
420016
420017
420018
420019
420020
420021
420022
420023
420024
420025
420026
420027
420028
420029
420030
420031
420032
420033
420034
420035
420036
420037
420038
420039
420040
420041
420042
...

output:

720050411
190468776
956741027
723496680
92960972
399268355
358775408
596997854
218933488
379638614
814464979
702546427
37542796
74895506
715244079
43327920
73031900
157381403
705758699
639288936
809524251
222922827
800284659
331816139
528108506
939722721
541320772
300286312
797209402
640864096
51428...

result:

ok 10000 numbers

Test #59:

score: 0
Accepted
time: 13ms
memory: 3296kb

input:

10000
430001
430002
430003
430004
430005
430006
430007
430008
430009
430010
430011
430012
430013
430014
430015
430016
430017
430018
430019
430020
430021
430022
430023
430024
430025
430026
430027
430028
430029
430030
430031
430032
430033
430034
430035
430036
430037
430038
430039
430040
430041
430042
...

output:

836457112
839673149
942870968
940890528
131009915
533305241
851497570
942154078
872818492
493024883
582059644
465734012
486707851
931863017
816612063
319946179
627359660
908840139
226469452
234981083
80595210
160806924
933875178
388121500
213839437
973748739
109774167
512648555
651045554
864375884
5...

result:

ok 10000 numbers

Test #60:

score: 0
Accepted
time: 8ms
memory: 3348kb

input:

10000
440001
440002
440003
440004
440005
440006
440007
440008
440009
440010
440011
440012
440013
440014
440015
440016
440017
440018
440019
440020
440021
440022
440023
440024
440025
440026
440027
440028
440029
440030
440031
440032
440033
440034
440035
440036
440037
440038
440039
440040
440041
440042
...

output:

442514209
495053585
33596284
94877367
785068266
982730887
340642026
136048252
328235144
818000357
450509441
174813026
676167056
682430225
500988490
937219174
703875585
943770066
970627005
347837310
786502383
413647776
863639165
853599631
959193448
585749669
403326336
349816950
771040816
624099240
28...

result:

ok 10000 numbers

Test #61:

score: 0
Accepted
time: 21ms
memory: 3448kb

input:

10000
450001
450002
450003
450004
450005
450006
450007
450008
450009
450010
450011
450012
450013
450014
450015
450016
450017
450018
450019
450020
450021
450022
450023
450024
450025
450026
450027
450028
450029
450030
450031
450032
450033
450034
450035
450036
450037
450038
450039
450040
450041
450042
...

output:

423922214
476819636
356376262
704624922
435308186
325102443
509230766
267003931
453104029
704528726
982440549
263523852
80093223
920881575
138077248
758200441
808157644
124007585
444791646
912726738
806830123
877848588
794686568
812255454
121773659
330562463
861650298
327433172
651281162
15397572
73...

result:

ok 10000 numbers

Test #62:

score: 0
Accepted
time: 8ms
memory: 3304kb

input:

10000
460001
460002
460003
460004
460005
460006
460007
460008
460009
460010
460011
460012
460013
460014
460015
460016
460017
460018
460019
460020
460021
460022
460023
460024
460025
460026
460027
460028
460029
460030
460031
460032
460033
460034
460035
460036
460037
460038
460039
460040
460041
460042
...

output:

711318610
210042752
841447371
749922738
397620875
108170051
989269715
833159387
510622486
90455319
122958253
860987873
338429541
186180774
962028438
509750506
614755219
493628802
502709900
625363717
689238016
968734169
57321686
940387649
505533544
899008283
421287340
700912796
755412242
167427778
95...

result:

ok 10000 numbers

Test #63:

score: 0
Accepted
time: 13ms
memory: 3296kb

input:

10000
470001
470002
470003
470004
470005
470006
470007
470008
470009
470010
470011
470012
470013
470014
470015
470016
470017
470018
470019
470020
470021
470022
470023
470024
470025
470026
470027
470028
470029
470030
470031
470032
470033
470034
470035
470036
470037
470038
470039
470040
470041
470042
...

output:

914982070
898904573
794659250
699387494
185130956
942992885
197853194
678985464
140095022
627821969
1083794
713020989
289214584
580718440
422824602
572715208
917998343
401684585
744160371
582610405
86968953
537380689
631768585
133621499
412867689
404173661
478630118
173933285
81744689
558854837
5054...

result:

ok 10000 numbers

Test #64:

score: 0
Accepted
time: 14ms
memory: 3396kb

input:

10000
480001
480002
480003
480004
480005
480006
480007
480008
480009
480010
480011
480012
480013
480014
480015
480016
480017
480018
480019
480020
480021
480022
480023
480024
480025
480026
480027
480028
480029
480030
480031
480032
480033
480034
480035
480036
480037
480038
480039
480040
480041
480042
...

output:

605171844
789115472
171843360
113282001
574416622
301138119
392805579
492424688
390768871
60297142
56576693
120121265
586617238
44555677
983527064
335306967
153259266
474931447
823453413
324898371
933542202
177483567
347758372
290447398
2154766
897524649
985828484
896482720
177894162
234008002
46911...

result:

ok 10000 numbers

Test #65:

score: 0
Accepted
time: 11ms
memory: 3276kb

input:

10000
490001
490002
490003
490004
490005
490006
490007
490008
490009
490010
490011
490012
490013
490014
490015
490016
490017
490018
490019
490020
490021
490022
490023
490024
490025
490026
490027
490028
490029
490030
490031
490032
490033
490034
490035
490036
490037
490038
490039
490040
490041
490042
...

output:

668271744
736463270
5019635
320481544
590667807
43595103
301872899
54107371
778742061
242918754
732454567
32112941
33460023
980906430
303591447
335067264
734102891
716686457
57724051
655798451
784154174
519590286
401121028
651345603
635130922
995589350
543256086
459957835
74931988
377640832
22481158...

result:

ok 10000 numbers

Test #66:

score: 0
Accepted
time: 17ms
memory: 3268kb

input:

10000
500001
500002
500003
500004
500005
500006
500007
500008
500009
500010
500011
500012
500013
500014
500015
500016
500017
500018
500019
500020
500021
500022
500023
500024
500025
500026
500027
500028
500029
500030
500031
500032
500033
500034
500035
500036
500037
500038
500039
500040
500041
500042
...

output:

996395237
457857021
344412309
603267859
389279489
758661958
673450872
641510600
964512687
489524996
214531993
139492799
990889424
372275050
42077109
285010009
534020501
633677006
692809324
532064529
352274077
65351696
985877779
151532733
490810689
430124269
262807495
321364789
977635873
552223113
90...

result:

ok 10000 numbers

Test #67:

score: 0
Accepted
time: 12ms
memory: 3372kb

input:

10000
510001
510002
510003
510004
510005
510006
510007
510008
510009
510010
510011
510012
510013
510014
510015
510016
510017
510018
510019
510020
510021
510022
510023
510024
510025
510026
510027
510028
510029
510030
510031
510032
510033
510034
510035
510036
510037
510038
510039
510040
510041
510042
...

output:

146225389
913376578
666205353
597402183
134509560
771087369
492010264
407093263
805317083
44139510
826256978
627484991
165796821
33656977
346329423
991971642
811161002
890671662
126269328
251485436
721496691
189700050
249300518
700965029
714675837
81540161
38914249
9025246
328622514
698867956
469754...

result:

ok 10000 numbers

Test #68:

score: 0
Accepted
time: 7ms
memory: 3264kb

input:

10000
520001
520002
520003
520004
520005
520006
520007
520008
520009
520010
520011
520012
520013
520014
520015
520016
520017
520018
520019
520020
520021
520022
520023
520024
520025
520026
520027
520028
520029
520030
520031
520032
520033
520034
520035
520036
520037
520038
520039
520040
520041
520042
...

output:

757052169
402136073
782636418
831563703
928512451
838876825
671488109
876930925
91188181
948000886
433585325
453080303
579074226
494971447
232443779
555590793
575207289
51990202
394838901
268854729
765378043
469804281
899614009
610743092
603802438
304295282
89269939
142427673
835921584
130708703
909...

result:

ok 10000 numbers

Test #69:

score: 0
Accepted
time: 6ms
memory: 3268kb

input:

10000
530001
530002
530003
530004
530005
530006
530007
530008
530009
530010
530011
530012
530013
530014
530015
530016
530017
530018
530019
530020
530021
530022
530023
530024
530025
530026
530027
530028
530029
530030
530031
530032
530033
530034
530035
530036
530037
530038
530039
530040
530041
530042
...

output:

744933616
531117682
462571406
885916867
556602285
558340286
160253562
423037508
155630627
644787932
643921340
503939213
407857193
550029919
493609459
580633645
422502846
466724357
131993177
456968206
210127324
610873167
240115842
444173425
195800814
643113142
290435922
680073022
648135182
627335288
...

result:

ok 10000 numbers

Test #70:

score: 0
Accepted
time: 12ms
memory: 3348kb

input:

10000
540001
540002
540003
540004
540005
540006
540007
540008
540009
540010
540011
540012
540013
540014
540015
540016
540017
540018
540019
540020
540021
540022
540023
540024
540025
540026
540027
540028
540029
540030
540031
540032
540033
540034
540035
540036
540037
540038
540039
540040
540041
540042
...

output:

597183583
951448652
309354894
522266366
374375799
132598091
479188438
956777697
877911137
146047105
862441328
641559384
818693743
996109600
283887234
210861427
471968310
966728280
595509700
146431486
698094071
866847665
712586438
240359083
686337462
672992690
493358983
892899175
492172159
623709769
...

result:

ok 10000 numbers

Test #71:

score: 0
Accepted
time: 6ms
memory: 3376kb

input:

10000
550001
550002
550003
550004
550005
550006
550007
550008
550009
550010
550011
550012
550013
550014
550015
550016
550017
550018
550019
550020
550021
550022
550023
550024
550025
550026
550027
550028
550029
550030
550031
550032
550033
550034
550035
550036
550037
550038
550039
550040
550041
550042
...

output:

243180811
561611073
35932890
877976859
754455895
559923401
182231813
359227584
766441976
854444183
870277796
733882020
200149886
39239069
705612613
511002015
563529457
277726012
988169379
923287991
882343036
229294127
511318239
965672554
149062344
820847248
952536318
313784196
109060401
306564968
80...

result:

ok 10000 numbers

Test #72:

score: 0
Accepted
time: 12ms
memory: 3304kb

input:

10000
560001
560002
560003
560004
560005
560006
560007
560008
560009
560010
560011
560012
560013
560014
560015
560016
560017
560018
560019
560020
560021
560022
560023
560024
560025
560026
560027
560028
560029
560030
560031
560032
560033
560034
560035
560036
560037
560038
560039
560040
560041
560042
...

output:

627453692
200840634
749960485
576545635
178889220
686546895
504431815
865521826
543154583
172488336
822074669
153671970
419735969
336975762
979073829
751468337
445340732
995467333
643360804
841262628
807563428
725736024
209864874
424436022
220246536
702231760
516388042
158896702
970314041
926593795
...

result:

ok 10000 numbers

Test #73:

score: 0
Accepted
time: 12ms
memory: 3444kb

input:

10000
570001
570002
570003
570004
570005
570006
570007
570008
570009
570010
570011
570012
570013
570014
570015
570016
570017
570018
570019
570020
570021
570022
570023
570024
570025
570026
570027
570028
570029
570030
570031
570032
570033
570034
570035
570036
570037
570038
570039
570040
570041
570042
...

output:

830510582
775805951
235651813
234999098
355591618
971952621
56409479
682151285
78913539
216493928
178295684
199591141
142103770
608682475
281432476
852060666
574424471
742708542
404907861
973046972
23498128
955723841
53223847
308126298
524802761
168397988
99203979
162506166
781853174
445829282
49935...

result:

ok 10000 numbers

Test #74:

score: 0
Accepted
time: 13ms
memory: 3336kb

input:

10000
580001
580002
580003
580004
580005
580006
580007
580008
580009
580010
580011
580012
580013
580014
580015
580016
580017
580018
580019
580020
580021
580022
580023
580024
580025
580026
580027
580028
580029
580030
580031
580032
580033
580034
580035
580036
580037
580038
580039
580040
580041
580042
...

output:

610385105
925663038
393597416
127715077
407118741
560906644
267000797
318576130
404350458
623183469
676596785
901342193
527764531
356091919
224576035
365844697
854162665
849925299
497292721
47052854
931720450
680900010
135054746
17884999
254952916
243230089
485789377
162627956
199229682
949587766
74...

result:

ok 10000 numbers

Test #75:

score: 0
Accepted
time: 13ms
memory: 3448kb

input:

10000
590001
590002
590003
590004
590005
590006
590007
590008
590009
590010
590011
590012
590013
590014
590015
590016
590017
590018
590019
590020
590021
590022
590023
590024
590025
590026
590027
590028
590029
590030
590031
590032
590033
590034
590035
590036
590037
590038
590039
590040
590041
590042
...

output:

779331161
422316787
4689803
793269421
340714642
956011889
36985468
521066077
922596655
4272285
238379063
211827633
4222595
679136473
6260404
789368473
107680220
359022092
168762473
564845590
878591206
377866290
154365755
736043179
44752447
411361356
275972433
945684908
74766487
699373804
234298894
5...

result:

ok 10000 numbers

Test #76:

score: 0
Accepted
time: 16ms
memory: 3340kb

input:

10000
600001
600002
600003
600004
600005
600006
600007
600008
600009
600010
600011
600012
600013
600014
600015
600016
600017
600018
600019
600020
600021
600022
600023
600024
600025
600026
600027
600028
600029
600030
600031
600032
600033
600034
600035
600036
600037
600038
600039
600040
600041
600042
...

output:

220998407
575416588
182349199
883186775
542009964
691204620
558272160
267645988
914951022
551469436
583893857
672617490
747405484
963315107
436432269
30633159
831535850
315290627
706975996
830110634
551998427
142135808
165099119
523737912
29738800
171323377
47507418
77917665
371277579
79913764
59351...

result:

ok 10000 numbers

Test #77:

score: 0
Accepted
time: 13ms
memory: 3372kb

input:

10000
610001
610002
610003
610004
610005
610006
610007
610008
610009
610010
610011
610012
610013
610014
610015
610016
610017
610018
610019
610020
610021
610022
610023
610024
610025
610026
610027
610028
610029
610030
610031
610032
610033
610034
610035
610036
610037
610038
610039
610040
610041
610042
...

output:

728759201
940061167
757379975
762010398
913654619
838489181
956863332
242726645
478372053
501029969
374801638
265298873
166243544
363059239
625214433
355964181
873739753
436422769
948821813
564871990
606746993
77351849
775096104
619732186
99841796
594172756
284019617
190475961
826840215
8174559
1087...

result:

ok 10000 numbers

Test #78:

score: 0
Accepted
time: 13ms
memory: 3264kb

input:

10000
620001
620002
620003
620004
620005
620006
620007
620008
620009
620010
620011
620012
620013
620014
620015
620016
620017
620018
620019
620020
620021
620022
620023
620024
620025
620026
620027
620028
620029
620030
620031
620032
620033
620034
620035
620036
620037
620038
620039
620040
620041
620042
...

output:

990095200
705104885
789195070
372377394
533258233
757321306
721375469
938410161
740815991
707558537
847586590
632380697
653772823
298633625
316473152
903310901
613230386
423411146
18171207
840962201
204465575
462581564
589543790
477685836
312570829
635889058
402816903
518994420
47179847
323849821
56...

result:

ok 10000 numbers

Test #79:

score: 0
Accepted
time: 13ms
memory: 3240kb

input:

10000
630001
630002
630003
630004
630005
630006
630007
630008
630009
630010
630011
630012
630013
630014
630015
630016
630017
630018
630019
630020
630021
630022
630023
630024
630025
630026
630027
630028
630029
630030
630031
630032
630033
630034
630035
630036
630037
630038
630039
630040
630041
630042
...

output:

541215579
82558811
943437264
622125811
918152855
715797416
870119315
649345919
958602083
427748231
860945822
465307680
886236701
122232917
621746825
838287607
251765937
90241126
931598236
482807987
52109877
981770144
483136131
741360932
766963038
481448665
731519072
120658949
171191187
315086107
412...

result:

ok 10000 numbers

Test #80:

score: 0
Accepted
time: 5ms
memory: 3212kb

input:

10000
640001
640002
640003
640004
640005
640006
640007
640008
640009
640010
640011
640012
640013
640014
640015
640016
640017
640018
640019
640020
640021
640022
640023
640024
640025
640026
640027
640028
640029
640030
640031
640032
640033
640034
640035
640036
640037
640038
640039
640040
640041
640042
...

output:

864226060
476680437
304132210
939837827
907342530
900595671
296562802
980913152
902716498
507315586
107083058
382740674
771354924
396456661
503662818
552478050
96831003
83110089
387540518
730458259
639504800
166422589
41814718
465308997
996877399
746667944
328426936
515142119
772041772
750766615
849...

result:

ok 10000 numbers

Test #81:

score: 0
Accepted
time: 12ms
memory: 3264kb

input:

10000
650001
650002
650003
650004
650005
650006
650007
650008
650009
650010
650011
650012
650013
650014
650015
650016
650017
650018
650019
650020
650021
650022
650023
650024
650025
650026
650027
650028
650029
650030
650031
650032
650033
650034
650035
650036
650037
650038
650039
650040
650041
650042
...

output:

298332713
502640978
621600151
331248654
468759785
495179855
96838792
258673860
813158446
731118185
453529571
455305124
520144674
278776859
638817482
408999306
974779598
820454326
329587071
618076534
991002955
675736462
802072098
142570304
588114236
903894668
139760593
487086172
400802206
301791134
2...

result:

ok 10000 numbers

Test #82:

score: 0
Accepted
time: 16ms
memory: 3300kb

input:

10000
660001
660002
660003
660004
660005
660006
660007
660008
660009
660010
660011
660012
660013
660014
660015
660016
660017
660018
660019
660020
660021
660022
660023
660024
660025
660026
660027
660028
660029
660030
660031
660032
660033
660034
660035
660036
660037
660038
660039
660040
660041
660042
...

output:

227670230
511258102
921582172
968621938
886945470
470888616
325159991
951796340
802147744
143583828
97223440
250802952
329810848
805491572
346907919
760637543
801228690
694753126
43639102
367191989
170955625
548695837
704399549
693465067
917941981
468590480
327957259
786035410
592659071
156650730
40...

result:

ok 10000 numbers

Test #83:

score: 0
Accepted
time: 13ms
memory: 3372kb

input:

10000
670001
670002
670003
670004
670005
670006
670007
670008
670009
670010
670011
670012
670013
670014
670015
670016
670017
670018
670019
670020
670021
670022
670023
670024
670025
670026
670027
670028
670029
670030
670031
670032
670033
670034
670035
670036
670037
670038
670039
670040
670041
670042
...

output:

611265312
690099467
917483236
37698094
58070556
267210969
976846710
600550097
748144521
270921806
900729747
997764360
420210187
809248221
975044491
370948710
155549499
145075050
221345007
916167050
208965129
148964833
198922974
265282847
437630253
475493628
487309586
500184659
634846829
197718608
52...

result:

ok 10000 numbers

Test #84:

score: 0
Accepted
time: 13ms
memory: 3296kb

input:

10000
680001
680002
680003
680004
680005
680006
680007
680008
680009
680010
680011
680012
680013
680014
680015
680016
680017
680018
680019
680020
680021
680022
680023
680024
680025
680026
680027
680028
680029
680030
680031
680032
680033
680034
680035
680036
680037
680038
680039
680040
680041
680042
...

output:

985419203
650718357
811631268
171955680
75514866
50173578
472542824
653857694
54095619
221498913
478217915
732880026
695402824
883293653
501787832
891981105
371545135
276015318
536625519
964777437
40224887
882996629
224582061
384848687
661373185
869651927
483679070
47787470
119392679
134781510
82052...

result:

ok 10000 numbers

Test #85:

score: 0
Accepted
time: 12ms
memory: 3268kb

input:

10000
690001
690002
690003
690004
690005
690006
690007
690008
690009
690010
690011
690012
690013
690014
690015
690016
690017
690018
690019
690020
690021
690022
690023
690024
690025
690026
690027
690028
690029
690030
690031
690032
690033
690034
690035
690036
690037
690038
690039
690040
690041
690042
...

output:

226603875
688301903
490250874
419336770
832508884
376948988
30414524
270346367
22968397
694894821
91248447
560595206
434696626
920485774
432136788
282300917
55499087
577317766
79463650
902526419
13732495
148025810
758387323
454512182
535359201
988896555
14680287
722504745
265348205
436155864
9753872...

result:

ok 10000 numbers

Test #86:

score: 0
Accepted
time: 13ms
memory: 3344kb

input:

10000
700001
700002
700003
700004
700005
700006
700007
700008
700009
700010
700011
700012
700013
700014
700015
700016
700017
700018
700019
700020
700021
700022
700023
700024
700025
700026
700027
700028
700029
700030
700031
700032
700033
700034
700035
700036
700037
700038
700039
700040
700041
700042
...

output:

718034531
540354175
894047216
407334248
955496354
62277514
380488244
406278785
394153066
718576774
597308143
795963281
435237503
945925216
402464140
967459654
221923096
877555515
215600118
263920017
636028704
843913317
794148837
604697716
874049602
628247162
639376158
539891615
613672245
254650089
5...

result:

ok 10000 numbers

Test #87:

score: 0
Accepted
time: 13ms
memory: 3332kb

input:

10000
710001
710002
710003
710004
710005
710006
710007
710008
710009
710010
710011
710012
710013
710014
710015
710016
710017
710018
710019
710020
710021
710022
710023
710024
710025
710026
710027
710028
710029
710030
710031
710032
710033
710034
710035
710036
710037
710038
710039
710040
710041
710042
...

output:

261141846
784455395
236110472
161082418
224358669
120848217
156920457
563415350
51461325
499090862
830752272
801044821
43235125
508585321
995550230
173875293
979144722
457131345
533081004
930412465
955262317
85468122
894688561
521048095
73722438
457137913
527702220
478256654
644866828
689419185
2815...

result:

ok 10000 numbers

Test #88:

score: 0
Accepted
time: 9ms
memory: 3208kb

input:

10000
720001
720002
720003
720004
720005
720006
720007
720008
720009
720010
720011
720012
720013
720014
720015
720016
720017
720018
720019
720020
720021
720022
720023
720024
720025
720026
720027
720028
720029
720030
720031
720032
720033
720034
720035
720036
720037
720038
720039
720040
720041
720042
...

output:

225867407
7219015
726654905
169327172
870421679
296253650
86196536
587875885
212314635
563443144
294164281
290018451
791728829
282304833
604219888
526556669
149011203
944689156
549559644
768890406
32227012
149995120
136040505
452868894
250786763
582928423
634089276
202888895
930731611
591663062
8303...

result:

ok 10000 numbers

Test #89:

score: 0
Accepted
time: 7ms
memory: 3336kb

input:

10000
730001
730002
730003
730004
730005
730006
730007
730008
730009
730010
730011
730012
730013
730014
730015
730016
730017
730018
730019
730020
730021
730022
730023
730024
730025
730026
730027
730028
730029
730030
730031
730032
730033
730034
730035
730036
730037
730038
730039
730040
730041
730042
...

output:

920196362
977507620
928464468
147619712
709794059
435822361
73067947
479601806
920089203
387832129
223088207
322149604
620729859
789927052
871626073
598146812
175454331
474554580
948199093
949526726
773387887
478457303
868929618
511731879
878931418
9761856
979965658
286649873
276904054
984083877
169...

result:

ok 10000 numbers

Test #90:

score: 0
Accepted
time: 15ms
memory: 3448kb

input:

10000
740001
740002
740003
740004
740005
740006
740007
740008
740009
740010
740011
740012
740013
740014
740015
740016
740017
740018
740019
740020
740021
740022
740023
740024
740025
740026
740027
740028
740029
740030
740031
740032
740033
740034
740035
740036
740037
740038
740039
740040
740041
740042
...

output:

695983053
64128190
943468278
785599875
616195672
309033878
195879727
579597478
662692194
912080007
142992438
592562971
323579642
542271846
352385423
964024245
247255561
535107470
456931239
395919919
161784003
80356944
291383467
911360590
152427819
311794309
379206993
922654691
630810620
63829229
400...

result:

ok 10000 numbers

Test #91:

score: 0
Accepted
time: 14ms
memory: 3300kb

input:

10000
750001
750002
750003
750004
750005
750006
750007
750008
750009
750010
750011
750012
750013
750014
750015
750016
750017
750018
750019
750020
750021
750022
750023
750024
750025
750026
750027
750028
750029
750030
750031
750032
750033
750034
750035
750036
750037
750038
750039
750040
750041
750042
...

output:

449567502
901527499
401866444
888605694
668622314
106856315
425549408
627123207
777327380
608163246
168799899
700283833
665930033
439313774
676810956
973983480
585641508
802281287
206554635
552202095
123639007
327232481
208212687
610524437
78761889
605666515
781562445
901139485
983820491
587213265
4...

result:

ok 10000 numbers

Test #92:

score: 0
Accepted
time: 13ms
memory: 3304kb

input:

10000
760001
760002
760003
760004
760005
760006
760007
760008
760009
760010
760011
760012
760013
760014
760015
760016
760017
760018
760019
760020
760021
760022
760023
760024
760025
760026
760027
760028
760029
760030
760031
760032
760033
760034
760035
760036
760037
760038
760039
760040
760041
760042
...

output:

976095276
765607448
806046488
791237410
974649894
825827165
679466535
158698350
691715889
339992307
592367
400562588
184604608
769138502
550971441
51168126
570484062
705823412
298491006
935886189
864528463
44948637
563126513
154397105
92688201
404151832
472878682
640228984
739278224
682372802
907820...

result:

ok 10000 numbers

Test #93:

score: 0
Accepted
time: 14ms
memory: 3332kb

input:

10000
770001
770002
770003
770004
770005
770006
770007
770008
770009
770010
770011
770012
770013
770014
770015
770016
770017
770018
770019
770020
770021
770022
770023
770024
770025
770026
770027
770028
770029
770030
770031
770032
770033
770034
770035
770036
770037
770038
770039
770040
770041
770042
...

output:

539390450
908710866
146288471
622940056
161562391
575810081
845650223
376841608
450097258
567363518
841332691
842080387
279189161
903524661
961224634
402240510
865404363
597490048
518068320
905297883
830942232
427286023
515662832
891121067
847846500
6621681
458524776
496671920
754850762
642578158
71...

result:

ok 10000 numbers

Test #94:

score: 0
Accepted
time: 13ms
memory: 3328kb

input:

10000
780001
780002
780003
780004
780005
780006
780007
780008
780009
780010
780011
780012
780013
780014
780015
780016
780017
780018
780019
780020
780021
780022
780023
780024
780025
780026
780027
780028
780029
780030
780031
780032
780033
780034
780035
780036
780037
780038
780039
780040
780041
780042
...

output:

744053963
963586121
687772629
534860345
535364772
173952502
117649304
13633252
728410965
786831144
608324333
482105975
899537300
377452608
947625579
73362799
218508817
155503271
964244209
332413152
90738333
220902280
55098721
712044961
866826343
435475108
16752690
911402316
463962371
776406402
31216...

result:

ok 10000 numbers

Test #95:

score: 0
Accepted
time: 10ms
memory: 3276kb

input:

10000
790001
790002
790003
790004
790005
790006
790007
790008
790009
790010
790011
790012
790013
790014
790015
790016
790017
790018
790019
790020
790021
790022
790023
790024
790025
790026
790027
790028
790029
790030
790031
790032
790033
790034
790035
790036
790037
790038
790039
790040
790041
790042
...

output:

767961632
12396737
132154175
703291305
62742823
620260938
480184645
551671855
503771040
938462019
641920181
900845189
737615006
599338226
77226034
21141907
346301454
59687128
304184016
353826541
104126706
898130557
688733931
205721306
309220162
475800666
905528787
804052960
883497458
492197921
35682...

result:

ok 10000 numbers

Test #96:

score: 0
Accepted
time: 8ms
memory: 3352kb

input:

10000
800001
800002
800003
800004
800005
800006
800007
800008
800009
800010
800011
800012
800013
800014
800015
800016
800017
800018
800019
800020
800021
800022
800023
800024
800025
800026
800027
800028
800029
800030
800031
800032
800033
800034
800035
800036
800037
800038
800039
800040
800041
800042
...

output:

602277535
371273556
789009989
143638073
740649852
788408791
890857992
314795906
655407960
203017450
10361965
179842430
949559799
396536829
426627322
250861837
128124422
940807381
806608647
615505380
119474654
902254248
595993741
478588588
6171185
441827585
561390392
519476711
964956803
783991679
854...

result:

ok 10000 numbers

Test #97:

score: 0
Accepted
time: 9ms
memory: 3452kb

input:

10000
810001
810002
810003
810004
810005
810006
810007
810008
810009
810010
810011
810012
810013
810014
810015
810016
810017
810018
810019
810020
810021
810022
810023
810024
810025
810026
810027
810028
810029
810030
810031
810032
810033
810034
810035
810036
810037
810038
810039
810040
810041
810042
...

output:

39654154
479314570
199792728
55887860
880884518
113714591
321507306
939365501
621358867
56838163
511063124
835650088
205481257
483922935
888630521
986097144
976530050
761650518
384752312
253491646
511324964
190710911
846244935
378849502
932372002
396859019
24647464
17807058
121372590
105219521
12709...

result:

ok 10000 numbers

Test #98:

score: 0
Accepted
time: 13ms
memory: 3332kb

input:

10000
820001
820002
820003
820004
820005
820006
820007
820008
820009
820010
820011
820012
820013
820014
820015
820016
820017
820018
820019
820020
820021
820022
820023
820024
820025
820026
820027
820028
820029
820030
820031
820032
820033
820034
820035
820036
820037
820038
820039
820040
820041
820042
...

output:

386730321
249127729
75416514
708558314
920593357
865464990
530261271
446681230
845660193
560577999
22054361
903529526
288277621
854501176
650213121
657453172
880045432
943798341
14961496
456120466
58353341
930316726
624695525
947815383
941228717
576806682
650580621
831675857
726531391
691064913
1749...

result:

ok 10000 numbers

Test #99:

score: 0
Accepted
time: 13ms
memory: 3336kb

input:

10000
830001
830002
830003
830004
830005
830006
830007
830008
830009
830010
830011
830012
830013
830014
830015
830016
830017
830018
830019
830020
830021
830022
830023
830024
830025
830026
830027
830028
830029
830030
830031
830032
830033
830034
830035
830036
830037
830038
830039
830040
830041
830042
...

output:

260757765
916925030
809831536
808443034
924077641
301453087
420126259
283463427
605130665
606925956
289904615
778686890
527140379
821782549
512943809
712397960
127518957
555559903
859251944
120483026
90169102
556751346
811324071
245371026
269194916
886164377
777598436
181764218
321212759
720467389
4...

result:

ok 10000 numbers

Test #100:

score: 0
Accepted
time: 12ms
memory: 3264kb

input:

10000
840001
840002
840003
840004
840005
840006
840007
840008
840009
840010
840011
840012
840013
840014
840015
840016
840017
840018
840019
840020
840021
840022
840023
840024
840025
840026
840027
840028
840029
840030
840031
840032
840033
840034
840035
840036
840037
840038
840039
840040
840041
840042
...

output:

456821365
940978646
437869035
890234185
819890649
814639567
7272573
947871184
337454420
709668497
848426963
52706740
142168006
218428640
214515954
694873532
639684186
127308537
586540092
769893254
364649848
131563429
700220641
211397880
292831678
911217563
860403207
648913189
609159327
931365982
653...

result:

ok 10000 numbers

Test #101:

score: 0
Accepted
time: 13ms
memory: 3212kb

input:

10000
850001
850002
850003
850004
850005
850006
850007
850008
850009
850010
850011
850012
850013
850014
850015
850016
850017
850018
850019
850020
850021
850022
850023
850024
850025
850026
850027
850028
850029
850030
850031
850032
850033
850034
850035
850036
850037
850038
850039
850040
850041
850042
...

output:

899989415
626998807
74676365
555444326
359331898
354902436
284845982
151631641
761568497
421544780
229547438
361972774
770929889
53123889
320491453
287739279
220860200
189951715
601474128
434023765
368116681
118953215
654287513
417560146
838216987
616443696
484798521
313035626
300409576
395882085
18...

result:

ok 10000 numbers

Test #102:

score: 0
Accepted
time: 5ms
memory: 3372kb

input:

10000
860001
860002
860003
860004
860005
860006
860007
860008
860009
860010
860011
860012
860013
860014
860015
860016
860017
860018
860019
860020
860021
860022
860023
860024
860025
860026
860027
860028
860029
860030
860031
860032
860033
860034
860035
860036
860037
860038
860039
860040
860041
860042
...

output:

898024525
175547695
474836865
181979769
529007413
875809399
579731624
126130192
988253118
761142007
560932675
567488306
445628933
205628611
990920757
963742490
183627497
730052580
258926844
486927590
539649908
664997112
154552198
53965664
208366232
69362748
71003683
366359505
481178261
135857597
517...

result:

ok 10000 numbers

Test #103:

score: 0
Accepted
time: 9ms
memory: 3264kb

input:

10000
870001
870002
870003
870004
870005
870006
870007
870008
870009
870010
870011
870012
870013
870014
870015
870016
870017
870018
870019
870020
870021
870022
870023
870024
870025
870026
870027
870028
870029
870030
870031
870032
870033
870034
870035
870036
870037
870038
870039
870040
870041
870042
...

output:

769360382
328098513
402524001
184361901
662132067
210385340
965601848
379916799
114059054
178543129
258533181
912300725
233833930
87396500
367668739
337702102
153351206
739524768
199229031
161867655
521901328
805031482
769933457
174137030
10629115
737087585
483391985
170040346
46278199
109533211
406...

result:

ok 10000 numbers

Test #104:

score: 0
Accepted
time: 13ms
memory: 3392kb

input:

10000
880001
880002
880003
880004
880005
880006
880007
880008
880009
880010
880011
880012
880013
880014
880015
880016
880017
880018
880019
880020
880021
880022
880023
880024
880025
880026
880027
880028
880029
880030
880031
880032
880033
880034
880035
880036
880037
880038
880039
880040
880041
880042
...

output:

813174949
360929708
272894243
490984994
490329431
566314745
576228668
358754483
299251022
382024937
798299504
607378971
566021570
182161876
217639649
771218681
333542449
80864400
291662607
487743998
676640517
401896706
135412681
848748229
955407574
853211936
2513308
788944971
90944405
166083106
6018...

result:

ok 10000 numbers

Test #105:

score: 0
Accepted
time: 13ms
memory: 3448kb

input:

10000
890001
890002
890003
890004
890005
890006
890007
890008
890009
890010
890011
890012
890013
890014
890015
890016
890017
890018
890019
890020
890021
890022
890023
890024
890025
890026
890027
890028
890029
890030
890031
890032
890033
890034
890035
890036
890037
890038
890039
890040
890041
890042
...

output:

214293787
752399221
64951433
810770259
587991570
651613879
392443516
406493764
564388706
682165810
21022202
245383315
871171465
991829588
18668483
256554178
670400515
581591694
718652911
915536680
164225157
987033373
715614009
431680613
727764275
27981603
197157602
321798256
899666650
854983975
4825...

result:

ok 10000 numbers

Test #106:

score: 0
Accepted
time: 14ms
memory: 3340kb

input:

10000
900001
900002
900003
900004
900005
900006
900007
900008
900009
900010
900011
900012
900013
900014
900015
900016
900017
900018
900019
900020
900021
900022
900023
900024
900025
900026
900027
900028
900029
900030
900031
900032
900033
900034
900035
900036
900037
900038
900039
900040
900041
900042
...

output:

247179986
866456749
750826041
432498850
977201686
268293526
921664246
910127668
796516769
371494196
235967878
545412653
804942833
907283624
239623971
274036767
993997672
407085882
793493844
909935276
418890272
467514569
532426289
435942778
272669661
916524779
896338067
344396621
771648251
775276673
...

result:

ok 10000 numbers

Test #107:

score: 0
Accepted
time: 13ms
memory: 3272kb

input:

10000
910001
910002
910003
910004
910005
910006
910007
910008
910009
910010
910011
910012
910013
910014
910015
910016
910017
910018
910019
910020
910021
910022
910023
910024
910025
910026
910027
910028
910029
910030
910031
910032
910033
910034
910035
910036
910037
910038
910039
910040
910041
910042
...

output:

39135415
60454053
299408614
925037224
716850681
274440230
699277027
545332297
157180591
219925517
987111670
11870290
75002314
610533188
730870497
296043704
139662303
940441203
53805925
679012060
422395235
121638601
676862968
444399536
85847765
237525788
97666619
296441608
721507999
425953382
3134820...

result:

ok 10000 numbers

Test #108:

score: 0
Accepted
time: 13ms
memory: 3344kb

input:

10000
920001
920002
920003
920004
920005
920006
920007
920008
920009
920010
920011
920012
920013
920014
920015
920016
920017
920018
920019
920020
920021
920022
920023
920024
920025
920026
920027
920028
920029
920030
920031
920032
920033
920034
920035
920036
920037
920038
920039
920040
920041
920042
...

output:

911152736
436869606
683737182
785674650
826339817
185528213
608228419
2478947
435631773
296119574
420675692
344225343
979590096
596003898
979717353
195604099
753379240
929035806
224519514
680032815
113163656
745038683
573854218
224609217
588317855
177736906
21089315
934332359
148217617
779969841
567...

result:

ok 10000 numbers

Test #109:

score: 0
Accepted
time: 12ms
memory: 3448kb

input:

10000
930001
930002
930003
930004
930005
930006
930007
930008
930009
930010
930011
930012
930013
930014
930015
930016
930017
930018
930019
930020
930021
930022
930023
930024
930025
930026
930027
930028
930029
930030
930031
930032
930033
930034
930035
930036
930037
930038
930039
930040
930041
930042
...

output:

529892859
83840284
996954414
88080060
910308130
983966991
59682933
944999671
374881853
503054929
466619185
642405467
970143858
506542873
832352792
497687465
494669271
506566021
621052683
489853605
268313495
417743402
798873143
457667604
189912879
956931819
368154144
175588256
655149388
254181316
701...

result:

ok 10000 numbers

Test #110:

score: 0
Accepted
time: 13ms
memory: 3264kb

input:

10000
940001
940002
940003
940004
940005
940006
940007
940008
940009
940010
940011
940012
940013
940014
940015
940016
940017
940018
940019
940020
940021
940022
940023
940024
940025
940026
940027
940028
940029
940030
940031
940032
940033
940034
940035
940036
940037
940038
940039
940040
940041
940042
...

output:

724479360
332597611
128194483
300442617
835318839
78863259
29353390
996368205
368214115
73253039
703682140
99372161
745326804
894828565
869652773
858848752
746881119
779312221
923407485
756521762
725092850
696859931
367411324
338362710
136668534
371803739
233238212
342028073
909854841
346527028
6997...

result:

ok 10000 numbers

Test #111:

score: 0
Accepted
time: 7ms
memory: 3220kb

input:

10000
950001
950002
950003
950004
950005
950006
950007
950008
950009
950010
950011
950012
950013
950014
950015
950016
950017
950018
950019
950020
950021
950022
950023
950024
950025
950026
950027
950028
950029
950030
950031
950032
950033
950034
950035
950036
950037
950038
950039
950040
950041
950042
...

output:

638751092
649412284
302970713
895759848
750156278
740547694
425035952
433415417
500910660
457819247
522190890
151151949
637510304
189053579
641807879
299907954
335293758
594439137
202637335
209472255
918208132
834367102
896722885
404576775
721433868
846693777
619035649
648805195
108806756
302704876
...

result:

ok 10000 numbers

Test #112:

score: 0
Accepted
time: 10ms
memory: 3332kb

input:

10000
960001
960002
960003
960004
960005
960006
960007
960008
960009
960010
960011
960012
960013
960014
960015
960016
960017
960018
960019
960020
960021
960022
960023
960024
960025
960026
960027
960028
960029
960030
960031
960032
960033
960034
960035
960036
960037
960038
960039
960040
960041
960042
...

output:

471307402
711221512
466204194
80864415
402272215
842808897
159177596
725686179
752408449
887029275
338263449
417850287
371888951
808082509
712622375
544161035
412630605
208840235
801275168
619716461
931373639
612275563
283251729
739364707
605426053
674112300
397515672
588233531
141916324
469687599
2...

result:

ok 10000 numbers

Test #113:

score: 0
Accepted
time: 9ms
memory: 3212kb

input:

10000
970001
970002
970003
970004
970005
970006
970007
970008
970009
970010
970011
970012
970013
970014
970015
970016
970017
970018
970019
970020
970021
970022
970023
970024
970025
970026
970027
970028
970029
970030
970031
970032
970033
970034
970035
970036
970037
970038
970039
970040
970041
970042
...

output:

401235446
536250077
241069242
837630306
311794816
211318258
510781718
821072852
807828672
199240829
533320026
236845659
178240089
109640974
952155461
874891447
269173172
242688423
342865914
389335724
528279313
285179944
569368483
430009949
152913596
792333105
797952305
270944993
814802454
413164993
...

result:

ok 10000 numbers

Test #114:

score: 0
Accepted
time: 13ms
memory: 3332kb

input:

10000
980001
980002
980003
980004
980005
980006
980007
980008
980009
980010
980011
980012
980013
980014
980015
980016
980017
980018
980019
980020
980021
980022
980023
980024
980025
980026
980027
980028
980029
980030
980031
980032
980033
980034
980035
980036
980037
980038
980039
980040
980041
980042
...

output:

573046025
760645129
251856374
885159438
433880850
726032226
836091591
942343287
516917989
402152681
792098194
78889219
636694134
488080815
466997949
607336919
230129632
60117593
252480629
984959685
85669229
965786958
660097693
563348059
898834661
566042223
929581216
464446331
736399862
437860726
136...

result:

ok 10000 numbers

Test #115:

score: 0
Accepted
time: 19ms
memory: 3436kb

input:

10000
990001
990002
990003
990004
990005
990006
990007
990008
990009
990010
990011
990012
990013
990014
990015
990016
990017
990018
990019
990020
990021
990022
990023
990024
990025
990026
990027
990028
990029
990030
990031
990032
990033
990034
990035
990036
990037
990038
990039
990040
990041
990042
...

output:

576407656
707703642
552912813
488986685
774316369
733354909
650221305
724932961
446461090
844626957
102643279
140132405
809809878
426203622
861486731
270042925
994974276
558079899
164995835
515997847
705095239
995262829
121885580
801160892
577734826
896872825
776155212
228981232
4194215
233042368
72...

result:

ok 10000 numbers

Test #116:

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

input:

10000
1000001
1000002
1000003
1000004
1000005
1000006
1000007
1000008
1000009
1000010
1000011
1000012
1000013
1000014
1000015
1000016
1000017
1000018
1000019
1000020
1000021
1000022
1000023
1000024
1000025
1000026
1000027
1000028
1000029
1000030
1000031
1000032
1000033
1000034
1000035
1000036
100003...

output:

630404300
495423945
229184277
416591866
28931290
189702442
290156624
707413542
667371211
279436802
183038691
19957387
482103917
847779568
318020995
783899024
335281367
431658845
180061509
325555132
870838965
568299775
126045150
637119010
569688035
800172582
382008378
534019629
317331119
820704687
68...

result:

ok 10000 numbers