This documentation is automatically generated by online-judge-tools/verification-helper
 modint/modint.hpp
 modint/modint.hpp
    
#include "modint/modint.hpp" Arbitrary Convolution
            (convolution/arbitrary_convolution.hpp)
 Arbitrary Convolution
            (convolution/arbitrary_convolution.hpp)
         Convolution $\pmod{2^{64}}$
            (convolution/convolution_mod_2_64.hpp)
 Convolution $\pmod{2^{64}}$
            (convolution/convolution_mod_2_64.hpp)
         $f^k \mod g$
            (fps/middle_product_arbitrary.hpp)
 $f^k \mod g$
            (fps/middle_product_arbitrary.hpp)
         Wildcard Pattern Matching
            (string/wildcard_pattern_matching.hpp)
 Wildcard Pattern Matching
            (string/wildcard_pattern_matching.hpp)
         test/aoj/aoj_2863.test.cpp
 test/aoj/aoj_2863.test.cpp
            
         test/aoj/aoj_3361.test.cpp
 test/aoj/aoj_3361.test.cpp
            
         test/convolution/Bitwise_And_Convolution.test.cpp
 test/convolution/Bitwise_And_Convolution.test.cpp
            
         test/convolution/Bitwise_OR_Convolution.test.cpp
 test/convolution/Bitwise_OR_Convolution.test.cpp
            
         test/convolution/Bitwise_Xor_Convolution.test.cpp
 test/convolution/Bitwise_Xor_Convolution.test.cpp
            
         test/convolution/Convolution.test.cpp
 test/convolution/Convolution.test.cpp
            
         test/convolution/Convolution_2D.test.cpp
 test/convolution/Convolution_2D.test.cpp
            
         test/convolution/Convolution_Mod_1000000007.test.cpp
 test/convolution/Convolution_Mod_1000000007.test.cpp
            
         test/convolution/Convolution_Mod_2_64.test.cpp
 test/convolution/Convolution_Mod_2_64.test.cpp
            
         test/convolution/Gcd_Convolution.test.cpp
 test/convolution/Gcd_Convolution.test.cpp
            
         test/convolution/Lcm_Convolution.test.cpp
 test/convolution/Lcm_Convolution.test.cpp
            
         test/convolution/Subset_Convolution.test.cpp
 test/convolution/Subset_Convolution.test.cpp
            
         test/data_structure/Deque_Operate_All_Composite.test.cpp
 test/data_structure/Deque_Operate_All_Composite.test.cpp
            
         test/data_structure/Dynamic_Sequence_Range_Affine_Range_Sum.test.cpp
 test/data_structure/Dynamic_Sequence_Range_Affine_Range_Sum.test.cpp
            
         test/data_structure/Point_Set_Range_Composite.test.cpp
 test/data_structure/Point_Set_Range_Composite.test.cpp
            
         test/data_structure/Queue_Operate_All_Composite.test.cpp
 test/data_structure/Queue_Operate_All_Composite.test.cpp
            
         test/data_structure/Range_Affine_Point_Get.test.cpp
 test/data_structure/Range_Affine_Point_Get.test.cpp
            
         test/data_structure/Range_Affine_Point_Get_Dynamic_Segtree.test.cpp
 test/data_structure/Range_Affine_Point_Get_Dynamic_Segtree.test.cpp
            
         test/data_structure/Range_Affine_Range_Sum.test.cpp
 test/data_structure/Range_Affine_Range_Sum.test.cpp
            
         test/data_structure/Range_Parallel_Unionfind.test.cpp
 test/data_structure/Range_Parallel_Unionfind.test.cpp
            
         test/data_structure/Vertex_Set_Path_Compositie.test.cpp
 test/data_structure/Vertex_Set_Path_Compositie.test.cpp
            
         test/graph/Counting_Eulerian_Circuits.test.cpp
 test/graph/Counting_Eulerian_Circuits.test.cpp
            
         test/graph/Counting_Spanning_Trees_Directed.test.cpp
 test/graph/Counting_Spanning_Trees_Directed.test.cpp
            
         test/graph/Counting_Spanning_Trees_Undirected.test.cpp
 test/graph/Counting_Spanning_Trees_Undirected.test.cpp
            
         test/math/Berunoulli_Number.test.cpp
 test/math/Berunoulli_Number.test.cpp
            
         test/math/Catalan_Convolution.test.cpp
 test/math/Catalan_Convolution.test.cpp
            
         test/math/Find_Linear_Recurrence.test.cpp
 test/math/Find_Linear_Recurrence.test.cpp
            
         test/math/Kth_term_of_Linearly_Recurrent_Sequence.test.cpp
 test/math/Kth_term_of_Linearly_Recurrent_Sequence.test.cpp
            
         test/math/Negative_Binomial_Coefficient.test.cpp
 test/math/Negative_Binomial_Coefficient.test.cpp
            
         test/math/Partition_Function_FPS.test.cpp
 test/math/Partition_Function_FPS.test.cpp
            
         test/math/Partition_Function_Pentagonal.test.cpp
 test/math/Partition_Function_Pentagonal.test.cpp
            
         test/math/Sharp_P_Subset_Sum.test.cpp
 test/math/Sharp_P_Subset_Sum.test.cpp
            
         test/math/Stirling_Number_of_the_First_Kind.test.cpp
 test/math/Stirling_Number_of_the_First_Kind.test.cpp
            
         test/math/Stirling_Number_of_the_Second_Kind.test.cpp
 test/math/Stirling_Number_of_the_Second_Kind.test.cpp
            
         test/math/Sum_of_Exponential_Times_Polynomial.test.cpp
 test/math/Sum_of_Exponential_Times_Polynomial.test.cpp
            
         test/math/Sum_of_Exponential_Times_Polynomial_Limit.test.cpp
 test/math/Sum_of_Exponential_Times_Polynomial_Limit.test.cpp
            
         test/math/Sum_of_Powers_Iota.test.cpp
 test/math/Sum_of_Powers_Iota.test.cpp
            
         test/math/Sum_of_Totient_Function.test.cpp
 test/math/Sum_of_Totient_Function.test.cpp
            
         test/matrix/Determinant_of_Matrix.test.cpp
 test/matrix/Determinant_of_Matrix.test.cpp
            
         test/matrix/Determinant_of_Matrix_2.test.cpp
 test/matrix/Determinant_of_Matrix_2.test.cpp
            
         test/matrix/Determinant_of_Sparse_Matrix.test.cpp
 test/matrix/Determinant_of_Sparse_Matrix.test.cpp
            
         test/matrix/Inverse_Matrix.test.cpp
 test/matrix/Inverse_Matrix.test.cpp
            
         test/matrix/Matrix_Product.test.cpp
 test/matrix/Matrix_Product.test.cpp
            
         test/matrix/Pow_of_Matrix.test.cpp
 test/matrix/Pow_of_Matrix.test.cpp
            
         test/matrix/Rank_of_Matrix.test.cpp
 test/matrix/Rank_of_Matrix.test.cpp
            
         test/matrix/System_of_Linear_Equations.test.cpp
 test/matrix/System_of_Linear_Equations.test.cpp
            
         test/polynomial/Composition_of_Formal_Power_Series.test.cpp
 test/polynomial/Composition_of_Formal_Power_Series.test.cpp
            
         test/polynomial/Composition_of_Formal_Power_Series_Large.test.cpp
 test/polynomial/Composition_of_Formal_Power_Series_Large.test.cpp
            
         test/polynomial/Compositional_Inverse_of_Formal_Power_Series.test.cpp
 test/polynomial/Compositional_Inverse_of_Formal_Power_Series.test.cpp
            
         test/polynomial/Compositional_Inverse_of_Formal_Power_Series_Large.test.cpp
 test/polynomial/Compositional_Inverse_of_Formal_Power_Series_Large.test.cpp
            
         test/polynomial/Division_of_Polynomials.test.cpp
 test/polynomial/Division_of_Polynomials.test.cpp
            
         test/polynomial/Exp_of_Formal_Power_Series.test.cpp
 test/polynomial/Exp_of_Formal_Power_Series.test.cpp
            
         test/polynomial/Exp_of_Formal_Power_Series_Sparse.test.cpp
 test/polynomial/Exp_of_Formal_Power_Series_Sparse.test.cpp
            
         test/polynomial/Inv_of_Formal_Power_Series.test.cpp
 test/polynomial/Inv_of_Formal_Power_Series.test.cpp
            
         test/polynomial/Inv_of_Formal_Power_Series_Sparse.test.cpp
 test/polynomial/Inv_of_Formal_Power_Series_Sparse.test.cpp
            
         test/polynomial/Log_of_Formal_Power_Series.test.cpp
 test/polynomial/Log_of_Formal_Power_Series.test.cpp
            
         test/polynomial/Log_of_Formal_Power_Series_Sparse.test.cpp
 test/polynomial/Log_of_Formal_Power_Series_Sparse.test.cpp
            
         test/polynomial/Multipoint_Evaluation.test.cpp
 test/polynomial/Multipoint_Evaluation.test.cpp
            
         test/polynomial/Polynomial_Interpolation.test.cpp
 test/polynomial/Polynomial_Interpolation.test.cpp
            
         test/polynomial/Polynomial_Taylor_Shift.test.cpp
 test/polynomial/Polynomial_Taylor_Shift.test.cpp
            
         test/polynomial/Pow_of_Formal_Power_Series.test.cpp
 test/polynomial/Pow_of_Formal_Power_Series.test.cpp
            
         test/polynomial/Pow_of_Formal_Power_Series_Sparse.test.cpp
 test/polynomial/Pow_of_Formal_Power_Series_Sparse.test.cpp
            
         test/polynomial/Product_of_Polynomial_Sequence.test.cpp
 test/polynomial/Product_of_Polynomial_Sequence.test.cpp
            
         test/polynomial/Shift_of_Sampling_Points_of_Polynomial.test.cpp
 test/polynomial/Shift_of_Sampling_Points_of_Polynomial.test.cpp
            
         test/polynomial/Sqrt_of_Formal_Power_Series.test.cpp
 test/polynomial/Sqrt_of_Formal_Power_Series.test.cpp
            
         test/polynomial/Sqrt_of_Formal_Power_Series_Sparse.test.cpp
 test/polynomial/Sqrt_of_Formal_Power_Series_Sparse.test.cpp
            
         test/set_function/Exp_of_Set_Power_Series.test.cpp
 test/set_function/Exp_of_Set_Power_Series.test.cpp
            
         test/set_function/Polynomial_Composite_Set_Power_Series.test.cpp
 test/set_function/Polynomial_Composite_Set_Power_Series.test.cpp
            
         test/string/Wildcard_Pattern_Matching.test.cpp
 test/string/Wildcard_Pattern_Matching.test.cpp
            
         test/tree/Frequency_Table_of_Tree_Distance_MODE_0.test.cpp
 test/tree/Frequency_Table_of_Tree_Distance_MODE_0.test.cpp
            
         test/tree/Frequency_Table_of_Tree_Distance_MODE_1.test.cpp
 test/tree/Frequency_Table_of_Tree_Distance_MODE_1.test.cpp
            
         test/tree/Frequency_Table_of_Tree_Distance_MODE_2.test.cpp
 test/tree/Frequency_Table_of_Tree_Distance_MODE_2.test.cpp
            
         test/tree/Point_Set_Tree_Path_Composition_Sum_Fixed_Root.test.cpp
 test/tree/Point_Set_Tree_Path_Composition_Sum_Fixed_Root.test.cpp
            
         test/tree/Tree_Path_Composite_Sum.test.cpp
 test/tree/Tree_Path_Composite_Sum.test.cpp
            
         test/yuki/yuki_1112.test.cpp
 test/yuki/yuki_1112.test.cpp
            
         test/yuki/yuki_1145.test.cpp
 test/yuki/yuki_1145.test.cpp
            
         test/yuki/yuki_1302.test.cpp
 test/yuki/yuki_1302.test.cpp
            
         test/yuki/yuki_1720.test.cpp
 test/yuki/yuki_1720.test.cpp
            
         test/yuki/yuki_1796.test.cpp
 test/yuki/yuki_1796.test.cpp
            
         test/yuki/yuki_1857.test.cpp
 test/yuki/yuki_1857.test.cpp
            
         test/yuki/yuki_2747.test.cpp
 test/yuki/yuki_2747.test.cpp
            
        #pragma once
#include <cassert>
#include <iostream>
#include "base.hpp"
namespace ebi {
template <int m> struct static_modint {
  private:
    using modint = static_modint;
  public:
    static constexpr int mod() {
        return m;
    }
    static constexpr modint raw(int v) {
        modint x;
        x._v = v;
        return x;
    }
    constexpr static_modint() : _v(0) {}
    template <std::signed_integral T> constexpr static_modint(T v) {
        long long x = (long long)(v % (long long)(umod()));
        if (x < 0) x += umod();
        _v = (unsigned int)(x);
    }
    template <std::unsigned_integral T> constexpr static_modint(T v) {
        _v = (unsigned int)(v % umod());
    }
    constexpr unsigned int val() const {
        return _v;
    }
    constexpr unsigned int value() const {
        return val();
    }
    constexpr modint &operator++() {
        _v++;
        if (_v == umod()) _v = 0;
        return *this;
    }
    constexpr modint &operator--() {
        if (_v == 0) _v = umod();
        _v--;
        return *this;
    }
    constexpr modint operator++(int) {
        modint res = *this;
        ++*this;
        return res;
    }
    constexpr modint operator--(int) {
        modint res = *this;
        --*this;
        return res;
    }
    constexpr modint &operator+=(const modint &rhs) {
        _v += rhs._v;
        if (_v >= umod()) _v -= umod();
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
        _v -= rhs._v;
        if (_v >= umod()) _v += umod();
        return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
        unsigned long long x = _v;
        x *= rhs._v;
        _v = (unsigned int)(x % (unsigned long long)umod());
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
        return *this = *this * rhs.inv();
    }
    constexpr modint operator+() const {
        return *this;
    }
    constexpr modint operator-() const {
        return modint() - *this;
    }
    constexpr modint pow(long long n) const {
        assert(0 <= n);
        modint x = *this, res = 1;
        while (n) {
            if (n & 1) res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }
    constexpr modint inv() const {
        assert(_v);
        return pow(umod() - 2);
    }
    friend modint operator+(const modint &lhs, const modint &rhs) {
        return modint(lhs) += rhs;
    }
    friend modint operator-(const modint &lhs, const modint &rhs) {
        return modint(lhs) -= rhs;
    }
    friend modint operator*(const modint &lhs, const modint &rhs) {
        return modint(lhs) *= rhs;
    }
    friend modint operator/(const modint &lhs, const modint &rhs) {
        return modint(lhs) /= rhs;
    }
    friend bool operator==(const modint &lhs, const modint &rhs) {
        return lhs.val() == rhs.val();
    }
    friend bool operator!=(const modint &lhs, const modint &rhs) {
        return !(lhs == rhs);
    }
  private:
    unsigned int _v = 0;
    static constexpr unsigned int umod() {
        return m;
    }
};
using modint998244353 = static_modint<998244353>;
using modint1000000007 = static_modint<1000000007>;
}  // namespace ebi#line 2 "modint/modint.hpp"
#include <cassert>
#include <iostream>
#line 2 "modint/base.hpp"
#include <concepts>
#line 5 "modint/base.hpp"
#include <utility>
namespace ebi {
template <class T>
concept Modint = requires(T a, T b) {
    a + b;
    a - b;
    a * b;
    a / b;
    a.inv();
    a.val();
    a.pow(std::declval<long long>());
    T::mod();
};
template <Modint mint> std::istream &operator>>(std::istream &os, mint &a) {
    long long x;
    os >> x;
    a = x;
    return os;
}
template <Modint mint>
std::ostream &operator<<(std::ostream &os, const mint &a) {
    return os << a.val();
}
}  // namespace ebi
#line 7 "modint/modint.hpp"
namespace ebi {
template <int m> struct static_modint {
  private:
    using modint = static_modint;
  public:
    static constexpr int mod() {
        return m;
    }
    static constexpr modint raw(int v) {
        modint x;
        x._v = v;
        return x;
    }
    constexpr static_modint() : _v(0) {}
    template <std::signed_integral T> constexpr static_modint(T v) {
        long long x = (long long)(v % (long long)(umod()));
        if (x < 0) x += umod();
        _v = (unsigned int)(x);
    }
    template <std::unsigned_integral T> constexpr static_modint(T v) {
        _v = (unsigned int)(v % umod());
    }
    constexpr unsigned int val() const {
        return _v;
    }
    constexpr unsigned int value() const {
        return val();
    }
    constexpr modint &operator++() {
        _v++;
        if (_v == umod()) _v = 0;
        return *this;
    }
    constexpr modint &operator--() {
        if (_v == 0) _v = umod();
        _v--;
        return *this;
    }
    constexpr modint operator++(int) {
        modint res = *this;
        ++*this;
        return res;
    }
    constexpr modint operator--(int) {
        modint res = *this;
        --*this;
        return res;
    }
    constexpr modint &operator+=(const modint &rhs) {
        _v += rhs._v;
        if (_v >= umod()) _v -= umod();
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
        _v -= rhs._v;
        if (_v >= umod()) _v += umod();
        return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
        unsigned long long x = _v;
        x *= rhs._v;
        _v = (unsigned int)(x % (unsigned long long)umod());
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
        return *this = *this * rhs.inv();
    }
    constexpr modint operator+() const {
        return *this;
    }
    constexpr modint operator-() const {
        return modint() - *this;
    }
    constexpr modint pow(long long n) const {
        assert(0 <= n);
        modint x = *this, res = 1;
        while (n) {
            if (n & 1) res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }
    constexpr modint inv() const {
        assert(_v);
        return pow(umod() - 2);
    }
    friend modint operator+(const modint &lhs, const modint &rhs) {
        return modint(lhs) += rhs;
    }
    friend modint operator-(const modint &lhs, const modint &rhs) {
        return modint(lhs) -= rhs;
    }
    friend modint operator*(const modint &lhs, const modint &rhs) {
        return modint(lhs) *= rhs;
    }
    friend modint operator/(const modint &lhs, const modint &rhs) {
        return modint(lhs) /= rhs;
    }
    friend bool operator==(const modint &lhs, const modint &rhs) {
        return lhs.val() == rhs.val();
    }
    friend bool operator!=(const modint &lhs, const modint &rhs) {
        return !(lhs == rhs);
    }
  private:
    unsigned int _v = 0;
    static constexpr unsigned int umod() {
        return m;
    }
};
using modint998244353 = static_modint<998244353>;
using modint1000000007 = static_modint<1000000007>;
}  // namespace ebi