import java.awt.Point;
import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class EasyNum {
    static boolean[] primes;
    static int[] memo;
    static int mod = (1<<30);
    public static void main(String[] args) {
        MyReader mr = new MyReader();

        int a = mr.nextInt();
        int b = mr.nextInt();
        int c = mr.nextInt();

        memo = new int[a*b*c+1];
        primes = new boolean[a*b*c+1];

        initPrimes();

        int res = 0;

        for (int i = 1; i <= a; i++)
            for(int j = 1; j<=b;j++)
                for(int k = 1; k<=c ;k++){
                    int val = i*j*k;
                    if(memo[val] == 0){
                        memo[val] = findDiv(val);
                    }

                    res+=memo[val];
                    res%=mod;
                }

        System.out.println(res);

    }

    private static int findDiv(int val) {
        int res = 1;
        for (int i = 2;i<=val;i++){
            if(primes[i] && val%i == 0){
                int count = 0;
                while (val%i == 0){
                    count++;
                    val/=i;
                }

                res=res*(count+1);
            }
        }

        return res;
    }

    private static void initPrimes() {
        Arrays.fill(primes,true);
        int n = primes.length;
        for (int i = 2; i < n; i++) {
            if (primes[i]){
                for (int j = 2; j*i < n ; j+=i) {
                    primes[j*i] = false;
                }
            }
        }
    }

    static class MyReader {
        BufferedReader br;
        StringTokenizer st;

        MyReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String res = "";
            try {
                res = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return res;
        }

        Integer[] nextIntArray(int n) {
            Integer[] arr = new Integer[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }

            return arr;
        }

        Long[] nextLongArray(int n) {
            Long[] arr = new Long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }

            return arr;
        }

        String[] nextStringArray(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }
    }

    static void swap(int[] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

}


fun main(args: Array<String>) {
    var t = readInt()
    var countOfL = 0
    var countOfR = 0

    var s = readLine()!!

    for (i in s){
        if (i=='L') countOfL++
        else countOfR++
    }
    println(countOfL+countOfR+1)
}


package main

import java.util.Scanner

fun main(args : Array<String>) {
    val scanner = Scanner(System.`in`)
    var n = scanner.nextInt()
    var s = scanner.nextLine()
    var c: Int = 0
    var z: Int = 0
    while (c<n)
    {
        if (s[c]=='0') {
            print(z)
            z=0
        }
        else z++
        c++
    }
    print(z)
}


import java.lang.Math.abs
import java.lang.Math.min
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val r = sc.nextInt()
    val c = sc.nextInt()

    val black = min(n - r, n - c) + 1
    val white = min(r - 1, c - 1)

    print(if(white < black) "white" else "black")
    main()
}


fun separate(s: IntArray, q: String): IntArray {
    if(s[s.size - 1] == q.length)
        return IntArray(0, { it })

    val c = HashSet<Char>()

    c.add(q[0])
    for(i in 0..s.size - 1) {
        if(q[s[i]] in c) {
            s[0]++

            for(j in 1..s.size - 1) {
                if(s[j] == s[j - 1]) {
                    s[j - 1] = 0
                    s[j]++
                }
            }

            return separate(s, q)
        }
        c.add(q[s[i]])
    }

    return s
}

fun main(args: Array<String>) {
    val k = readLine()!!.toInt()
    val q = readLine() ?: ""

    if(k > 1) {
        val s = separate(IntArray(k - 1, { it + 1 }), q)

        if(s.size > 0) {
            println("Yes")
            println(q.subSequence(0, s[0]))

            if(s.size > 2)
                for(i in 1..s.size - 2) {
                    println(q.subSequence(s[i], s[i + 1]))
                }

            println(q.subSequence(s[s.size - 1], q.length))
        } else {
            println("No")
        }
    } else {
        println("Yes")
        println(q)
    }
}


import java.util.Scanner;

public class YourAProfessional {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        int f = sc.nextInt();
        int I = sc.nextInt();
        int t = sc.nextInt();
        sc.nextLine();
        char[][] arr = new char[f][I];
        for(int i =0; i < f; i++){
            char[] nl = sc.nextLine().toCharArray();
            for (int j = 0; j < I; j++) {
                arr[i][j] = nl[j];
            }
        }
        int ans = 0;
        for (int i = 0; i < I; i++) {
           int count = 0;
            for (int j = 0; j < f; j++) {
                if(arr[j][i] == 'Y'){
                    count++;
                }
            }
            if(count>=t){
                ans++;
            }
        }
        System.out.println(ans);
    }
}


package codeforces

import codeforces.kotlinheroes4.readInt
import kotlin.test.assertEquals

private object Read {
    fun readLn() = readLine()!! // string line
    fun readInt() = readLn().toInt() // single int
    fun readLong() = readLn().toLong() // single long
    fun readDouble() = readLn().toDouble() // single double
    fun readStrings() = readLn().split(" ") // list of strings
    fun readInts() = readStrings().map { it.toInt() } // list of ints
    fun readLongs() = readStrings().map { it.toLong() } // list of longs
    fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
}

private fun arpasExam(degree: Int) = when (degree % 4) {
    1 -> 8
    2 -> 4
    3 -> 2
    0 -> 6
    else -> 0
}

fun main() {
    assertEquals(8, arpasExam(1))
    assertEquals(4, arpasExam(2))
    println(arpasExam(readInt()))

}


class Fraction {
    fun main(args: Array<String>) {
        val n = readLine()!!.toInt()
        var a = 0
        var b = 0

        if ((n % 2) == 0) {
            a = (n / 2) - 1
            b = (n / 2) + 1
        } else {
            a = (n / 2) - 1
            b = n / 2
        }

        println("$a $b")
    }
}


fun readInts() = readLine()!!.split(" ").map{i -> i.toInt()}.toMutableList()
fun readInt() = readLine()!!.toInt()
fun readLongs() = readLine()!!.split(" ").map{i -> i.toLong()}.toMutableList()

fun main() {
    val n = readInt()
    println(simpleFac(n) / n / (n / 2))
}

fun simpleFac(n: Int): Long {
    var f = 1L
    for (i in 2..n) {
        f *= i
    }

    return f
}


import java.io.*
import java.util.*
import kotlin.math.*

fun getComb(n: Int): Long {
    var u: Long = 1
    var d: Long = 1
    for (i in n downTo (n/2+1)) {
        u *= i.toLong()
    }
    for (i in 1..n/2) {
        d *= i.toLong()
    }
    return u/d
}

fun getPSq(n: Int): Long {
    var ans: Long = 1
    for (i in 1..n) {
        ans *= i.toLong()
    }
    return ans * ans
}

fun main() {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val writer = BufferedWriter(OutputStreamWriter(System.out))

    val t = reader.readLine().toInt()

    val c = getComb(t) / 2
    val p = getPSq(t/2-1)
    val ans = c*p
    writer.write("$ans\n")
    //tct/2

    writer.flush()
    reader.close()
    writer.close()
    return
}


fun pow(a : Long, b : Long) : Long{
    return if(b == 0L) 1
    else if(b % 2 == 1L) pow(a, b - 1) * a
    else pow(a, b / 2) * pow(a, b / 2)
}

fun factorial(a : Long) : Long{
    return if(a == 1L) 1
    else factorial(a - 1) * a
}

fun main(){
    val n = readLine()!!.toLong()
    val f = factorial(n)
    val e = pow((n / 2), 2) * 2
    print(f / e)
}


fun main() {
    val n = readInt()

    val k = n/2
    var factorial = 1L
    for (i in 1..n) factorial *= i

    println(factorial/(2 * k * k))
}

// Input Reader
private fun readLn() = readLine()!!

private fun readInt() = readLn().toInt()


import java.util.Scanner

fun main() {

    val sc = Scanner(System.`in`)
    val x : Int = sc.nextInt()
    val t : Int = sc.nextInt()
    var a = sc.nextInt()
    var b = sc.nextInt()
    val da : Int = sc.nextInt()
    val db : Int = sc.nextInt()

    for (i in 0 until t) {
        for (j in 0 until t) {
            if ((a - i * da) + (b - j * db) == x || a - i * da == x || b - j * db == x || x == 0) {
                print("YES")
                return
            }
        }
    }

    print("NO")

}


fun main() {
    val (k, p) = readLine()!!.split(" ").map(String::toLong)
    var result = 0L
    for (i in 1..k) {
        result += (i.toString() + i.toString().reversed()).toLong()
        result %= p
    }
    print(result)
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    //val n = r.readLine()!!.split(" ").map { it.toInt() }
    val n = r.readLine()!!.toInt()
    val min = n/7*2 + if (n%7==6) 1 else 0
    val max = n/7*2+ minOf(2, n%7)
    println("$min $max")
}


import java.io.*
import java.util.*
import kotlin.collections.ArrayList

class InputReader(stream: InputStream) {

    private var r = BufferedReader(InputStreamReader(stream), 32768)
    private var t = StringTokenizer("")
    private fun next(): String {
        while (!t.hasMoreTokens()) t = StringTokenizer(r.readLine())
        return t.nextToken()
    }

    fun nextInt() = java.lang.Integer.parseInt(next())
    fun nextLong() = java.lang.Long.parseLong(next())
    fun nextDouble() = java.lang.Double.parseDouble(next())
    fun nextLine() = r.readLine()!!
    fun nextIntArray(n: Int): ArrayList<Int> {
        val v = ArrayList<Int>()
        for (i in 0 until n) v.add(nextInt())
        return v
    }
}

var cin: InputReader = InputReader(System.`in`)
var cout: PrintWriter = PrintWriter(System.`out`)

fun main() {
    solve()
    cout.close()
}

fun solve() {
    val k = cin.nextInt()
    val n = cin.nextLine().toCharArray()

    if (n.take(k / 2).sumBy { it.toInt() } == n.takeLast(k - k / 2).sumBy { it.toInt() }
        && n.all { it == '4' || it == '7' })
        cout.print("YES")
    else
        cout.print("NO")

}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.AssertionError
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007
fun powMod(a: Long, n: Long, mod: Int): Long {
  if (n == 0L) return 1
  val res = powMod(a * a % mod, n / 2, mod)
  return if (n % 2 == 1L) res * a % mod else res
}
class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  private val reader = BufferedReader(InputStreamReader(stream), 32768)

  fun solve() {
    val S = ns()
    val N = S.length
    var ans = 0

    for (num in 0 until 100_000_000) {
      if (num % 25 != 0) continue
      val numStr = num.toString()
      if (numStr.length != N) continue // 0を含むleading0がない数値

      var x = -1
      var ok = true
      for (i in numStr.indices) {
        when(S[i]) {
          '_' -> {}
          'X' -> {
            if (x == -1) {
              x = numStr[i] - '0'
            } else {
              ok = ok && numStr[i] - '0' == x
            }
          }
          else -> ok = ok && numStr[i] == S[i]
        }
      }
      if (ok) ans++
    }

    out.println(ans)
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return IntArray(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  /**
   * コーナーケースでエラー出たりするので、debug(dp[1])のように添え字付きの場合はdebug{}をつかうこと
   */
  private inline fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: BooleanArray) {
    debug { toString(a) }
  }

  private inline fun toString(a: BooleanArray) = run{a.map { if (it) 1 else 0 }.joinToString("")}

  private inline fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<BooleanArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }

  private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}
  private inline fun assert(b: Boolean, f: () -> String) = run{if (!b) throw AssertionError(f())}

  companion object {
    // TestRunnerから呼びたいので単純なmainじゃだめ
    fun main() {
      val out = java.io.PrintWriter(System.out)
      Solver(System.`in`, out).solve()
      out.flush()
    }
  }
}

/**
 * judgeから呼ばれる
 */
fun main() = Solver.main()


import kotlin.math.max

fun main(args: Array<String>) {
    var (n, k, x) = readLine()!!.split(" ").map(String::toInt)
    val arr = readLine()!!.split(" ").map(String::toInt).toIntArray()
    if(n == 1) {
        println(0)
        return
    }
    var i = 0

    var maxCount = 0
    while (i < n){
        if(arr[i] == x && arr[i+1] == x) {
            var count = 2
            var l = 1
            var r = 1
            while (i-l>0 && i+r+1 < n) {
               if(arr[i-l] == arr[i+r+1]) {
                   if(i-l-1 >= 0) {
                       if(i+r+2 < n) {
                           if(arr[i-l] == arr[i-l-1] && arr[i+r+1] == arr[i+r+2]) {
                               count+=4
                               l+=2
                               r+=2
                           } else if(arr[i-l] == arr[i-l-1]) {
                               count+=3
                               l+=2
                               r++
                           } else if(arr[i+r+1] == arr[i+r+2]) {
                               count+=3
                               l++
                               r+=2
                           } else {
                               break
                           }
                       } else {
                           if(arr[i-l] == arr[i-l-1]) {
                               count+=3
                               l+=2
                               r++
                           } else {
                               break
                           }
                       }
                   } else {
                       if(i+r+2 < n) {
                           if(arr[i+r+1] == arr[i+r+2]) {
                               count+=3
                               l++
                               r+=2
                           }
                       } else {
                           break
                       }
                   }
               } else {
                   break
               }
            }
            if (maxCount < count) maxCount = count
            i++
        }
        i++
    }
    println(maxCount)
}


import kotlin.math.max

fun main(args: Array<String>) {
    var (n, k, x) = readLine()!!.split(" ").map(String::toInt)
    val arr = readLine()!!.split(" ").map(String::toInt).toIntArray()
    if(n == 1) {
        println(0)
        return
    }
    var i = 0

    var maxCount = 0
    while (i < n){
        if(arr[i] == x && arr[i+1] == x) {
            var count = 2
            var l = 1
            var r = 1
            while (i-l>0 && i+1+r < n) {
               if(arr[i-l] == arr[i+r+1]) {
                   when {
                       arr[i-l] == arr[i-l-1] && arr[i+r+1] == arr[i+r+2] -> {
                           count+=4
                           l-=2
                           r+=2
                       }
                       arr[i-l] == arr[i-l-1] -> {
                           count+=3
                           l-=2
                           r++
                       }
                       arr[i+r+1] == arr[i+r+2] -> {
                           count+=3
                           l--
                           r+=2
                       }
                   }
               }
            }
            if (maxCount < count) maxCount = count
            i++
        }
        i++
    }
    println(maxCount)
}


import kotlin.math.max

fun main(args: Array<String>) {
    var (n, k, x) = readLine()!!.split(" ").map(String::toInt)
    val arr = readLine()!!.split(" ").map(String::toInt).toIntArray()
    if(n == 1) {
        println(0)
        return
    }
    var i = 0

    var maxCount = 0
    while (i < n){
        if(arr[i] == x && arr[i+1] == x) {
            var count = 2
            var l = 1
            var r = 1
            while (i-l>0 && i+r+1 < n) {
               if(arr[i-l] == arr[i+r+1]) {
                   if(i-l-1 >= 0) {
                       if(i+r+2 < n) {
                           if(arr[i-l] == arr[i-l-1] && arr[i+r+1] == arr[i+r+2]) {
                               count+=4
                               l-=2
                               r+=2
                           } else if(arr[i-l] == arr[i-l-1]) {
                               count+=3
                               l-=2
                               r++
                           } else if(arr[i+r+1] == arr[i+r+2]) {
                               count+=3
                               l--
                               r+=2
                           }
                       } else {
                           if(arr[i-l] == arr[i-l-1]) {
                               count+=3
                               l-=2
                               r++
                           }
                       }
                   } else {
                       if(i+r+2 < n) {
                           if(arr[i+r+1] == arr[i+r+2]) {
                               count+=3
                               l--
                               r+=2
                           }
                       }
                   }
               }
            }
            if (maxCount < count) maxCount = count
            i++
        }
        i++
    }
    println(maxCount)
}


import java.util.Scanner;

fun main(args: Array<String>) {
    var scan = Scanner(System.`in`);

    var n = scan.nextInt();
    var s = IntArray(n);
    for (i in 0 until n) {
        s[i] = scan.nextInt();
    }

    var other = IntArray(n);
    var best = IntArray(n);
    best[n-1] = s[n-1];
    other[n-1] = 0;
    for (i in (n-2) downTo 0) {
        var takethis = s[i] + other[i+1];
        var givethis = best[i+1];
        if (takethis > givethis) {
            best[i] = takethis;
            other[i] = givethis;
        } else {
            best[i] = givethis;
            other[i] = takethis;
        }
    }
    System.out.printf("%d %d\n", other[0], best[0]);
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.PriorityQueue
import java.util.StringTokenizer
import java.util.TreeMap
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val percent = ModInt(100).inverse()

    val n = readInt()
    val pipes = List(n) { Pipe(readInt(), readInt(), percent * readInt()) }

    val tree = SegmentTree(n, null, nullIdentityCombiner(Seg::plus))

    tree.build { i ->
        Seg(
            ll = pipes[i].p.not(),
            lr = ModInt(0),
            rl = ModInt(0),
            rr = pipes[i].p,
            ban = NONE
        )
    }

    val cols = ArrayList<Collision>(2*n)

    for(i in 0 until n-1) {
        val a = pipes[i]
        val b = pipes[i+1]

        val d = b.x - a.x
        cols.add(Collision(i, RL, d, a.v + b.v))
        if(a.v > b.v) cols.add(Collision(i, RR, d, a.v - b.v))
        else if(a.v < b.v) cols.add(Collision(i, LL, d, b.v - a.v))
    }

    cols.sortWith(Collision.comparator)

    var currProb = ModInt(1)
    var ans = ModInt(0)
    for((a, t, d, v) in cols) {
        tree[a] = tree[a]!!.copy(ban = t)
        val prob = tree[0, tree.size]!!.sum
        ans += (currProb - prob) * d / v
        currProb = prob
    }

    println(ans.int)
}

inline fun ModInt.not() = ModInt(1) - this

data class Pipe(val x: Int, val v: Int, val p: ModInt)
data class Collision(val a: Int, val type: CollisionType, val d: Int, val v: Int) {
    companion object {
        val comparator = Comparator<Collision> { a, b ->
            (a.d.toLong() * b.v).compareTo(b.d.toLong() * a.v)
        }
    }

    inline val b get() = a + 1
}

inline class CollisionType(val i: Int)
inline val NONE get() = CollisionType(0)
inline val LL get() = CollisionType(1)
inline val RL get() = CollisionType(2)
inline val RR get() = CollisionType(3)

data class Seg(val ll: ModInt, val lr: ModInt, val rl: ModInt, val rr: ModInt, val ban: CollisionType) {
    val sum get() = ll + lr + rl + rr

    operator fun plus(b: Seg): Seg {
        // LR never banned
        var cll = ll * b.rl
        var clr = ll * b.rr
        var crl = rl * b.rl
        var crr = rl * b.rr

        // any ban implies RL banned
        if(ban == NONE) {
            cll += lr * b.ll
            clr += lr * b.lr
            crl += rr * b.ll
            crr += rr * b.lr
        }

        if(ban != LL) {
            cll += ll * b.ll
            clr += ll * b.lr
            crl += rl * b.ll
            crr += rl * b.lr
        }

        if(ban != RR) {
            cll += lr * b.rl
            clr += lr * b.rr
            crl += rr * b.rl
            crr += rr * b.rr
        }

        return Seg(cll, clr, crl, crr, b.ban)
    }
}

class SegmentTree<T>(
    val size: Int,
    val identityValue: T,
    val combiner: (T, T) -> T) {

    /* degenericization helpers
    val identityValue: T = TODO()
    fun combiner(a: T, b: T): T = TODO()
    */

    @Suppress("UNCHECKED_CAST")
    private val array = Array<Any?>(2 * size) { identityValue } as Array<T>

    inline val lastIndex get() = size - 1
    inline val indices get() = 0 until size
    val asList: List<T> by lazy {
        object : AbstractList<T>() {
            override val size: Int get() = this@SegmentTree.size
            override fun get(index: Int): T = this@SegmentTree[index]
        }
    }

    fun build(generator: (Int) -> T) {
        for(i in 0 until size) {
            array[i + size] = generator(i)
        }
        for(i in size-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** instantiates values from an iterable, O(n) time */
    fun copyFrom(iterable: Iterable<T>) {
        run {
            iterable.forEachIndexed { i, t ->
                if(i > lastIndex) return@run
                array[i + size] = t
            }
        }
        for(i in size-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Updates a value, O(log n) time */
    operator fun set(index: Int, value: T) {
        require(index in 0 until size)
        var i = index + size
        array[i] = value
        while(true) {
            i = i shr 1
            if(i <= 0) break
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Gets a value by its index, O(1) time */
    operator fun get(index: Int): T {
        require(index in 0 until size)
        return array[index + size]
    }

    /** gets the result of applying the monoid operation to the values in the index range, O(log n) time */
    operator fun get(start: Int, endExclusive: Int): T {
        var l = maxOf(start, 0) + size
        var r = minOf(endExclusive, size) + size

        // two accumulators to support non-commutative monoids
        var lAcc = identityValue
        var rAcc = identityValue

        while(l < r) {
            if(l and 1 == 1) {
                lAcc = combiner(lAcc, array[l++])
            }
            if(r and 1 == 1) {
                rAcc = combiner(array[--r], rAcc)
            }

            l = l shr 1
            r = r shr 1
        }

        return combiner(lAcc, rAcc)
    }

    operator fun get(range: IntRange) = get(range.first, range.last + 1)
}

/** Converts a semigroup to a monoid by using null as the identity value. */
inline fun <T: Any> nullIdentityCombiner(crossinline combiner: (T, T) -> T): (T?, T?) -> T? = { a, b ->
    when {
        a == null -> b
        b == null -> a
        else -> combiner(a, b)
    }
}

const val MOD = 998244353
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val percent = ModInt(100).inverse()

    val n = readInt()
    val pipes = List(n) { Pipe(readInt(), readInt(), percent * readInt()) }
    val tree = SegmentTree(n, null, nullIdentityCombiner(Seg::plus))

    tree.build { i ->
        Seg(
            ll = pipes[i].p.not(),
            lr = ModInt(0),
            rl = ModInt(0),
            rr = pipes[i].p,
            ban = NONE
        )
    }

    val cols = ArrayList<Collision>(n-1 shl 1)

    for(i in 0 until n-1) {
        val a = pipes[i]
        val b = pipes[i+1]

        val d = b.x - a.x
        cols.add(Collision(i, RL, d, a.v + b.v))
        if(a.v > b.v) cols.add(Collision(i, RR, d, a.v - b.v))
        else if(a.v < b.v) cols.add(Collision(i, LL, d, b.v - a.v))
    }

    cols.sortWith(Collision.comparator)

    val vi = ModIntArray(cols.size) { ModInt(cols[it].v) }.inverseOfEach()
    var currProb = ModInt(1)
    var ans = ModInt(0)
    for(i in cols.indices) {
        val (a, t, d) = cols[i]
        tree[a] = tree[a]!!.copy(ban = t)
        val prob = tree.root!!.sum
        ans += (currProb - prob) * d * vi[i]
        currProb = prob
    }

    println(ans.int)
}

inline fun ModInt.not() = ModInt(1) - this

data class Pipe(val x: Int, val v: Int, val p: ModInt)
data class Collision(val a: Int, val type: CollisionType, val d: Int, val v: Int) {
    companion object {
        val comparator = Comparator<Collision> { a, b ->
            (a.d.toLong() * b.v).compareTo(b.d.toLong() * a.v)
        }
    }

    inline val b get() = a + 1
}

typealias CollisionType = Byte
const val NONE: CollisionType = 0
const val LL: CollisionType = 1
const val RL: CollisionType = 2
const val RR: CollisionType = 3

data class Seg(val ll: ModInt, val lr: ModInt, val rl: ModInt, val rr: ModInt, val ban: CollisionType) {
    val sum get() = ll + lr + rl + rr

    operator fun plus(b: Seg): Seg {
        // LR never banned
        var cll = ll * b.rl
        var clr = ll * b.rr
        var crl = rl * b.rl
        var crr = rl * b.rr

        // any ban implies RL banned
        if(ban == NONE) {
            cll += lr * b.ll
            clr += lr * b.lr
            crl += rr * b.ll
            crr += rr * b.lr
        }

        if(ban != LL) {
            cll += ll * b.ll
            clr += ll * b.lr
            crl += rl * b.ll
            crr += rl * b.lr
        }

        if(ban != RR) {
            cll += lr * b.rl
            clr += lr * b.rr
            crl += rr * b.rl
            crr += rr * b.rr
        }

        return Seg(cll, clr, crl, crr, b.ban)
    }
}

class SegmentTree<T>(
    val size: Int,
    val identityValue: T,
    val combiner: (T, T) -> T) {

    private val tsize get() = if(size <= 1) size else Integer.highestOneBit(size - 1) shl 1

    /* degenericization helpers
    val identityValue: T = TODO()
    fun combiner(a: T, b: T): T = TODO()
    */

    @Suppress("UNCHECKED_CAST")
    private val array = Array<Any?>(tsize shl 1) { identityValue } as Array<T>

    val root get() = array[1]

    inline val lastIndex get() = size - 1
    inline val indices get() = 0 until size
    val asList: List<T> by lazy {
        object : AbstractList<T>() {
            override val size: Int get() = this@SegmentTree.size
            override fun get(index: Int): T = this@SegmentTree[index]
        }
    }

    fun build(generator: (Int) -> T) {
        for(i in 0 until size) {
            array[i + tsize] = generator(i)
        }
        for(i in tsize-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** instantiates values from an iterable, O(n) time */
    fun copyFrom(iterable: Iterable<T>) {
        run {
            iterable.forEachIndexed { i, t ->
                if(i > lastIndex) return@run
                array[i + tsize] = t
            }
        }
        for(i in tsize-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Updates a value, O(log n) time */
    operator fun set(index: Int, value: T) {
        require(index in 0 until size)
        var i = index + tsize
        array[i] = value
        while(true) {
            i = i shr 1
            if(i <= 0) break
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Gets a value by its index, O(1) time */
    operator fun get(index: Int): T {
        require(index in 0 until size)
        return array[index + tsize]
    }

    /** gets the result of applying the monoid operation to the values in the index range, O(log n) time */
    operator fun get(start: Int, endExclusive: Int): T {
        var l = maxOf(start, 0) + tsize
        var r = minOf(endExclusive, size) + tsize

        // two accumulators to support non-commutative monoids
        var lAcc = identityValue
        var rAcc = identityValue

        while(l < r) {
            if(l and 1 == 1) {
                lAcc = combiner(lAcc, array[l++])
            }
            if(r and 1 == 1) {
                rAcc = combiner(array[--r], rAcc)
            }

            l = l shr 1
            r = r shr 1
        }

        return combiner(lAcc, rAcc)
    }

    operator fun get(range: IntRange) = get(range.first, range.last + 1)
}

/** Converts a semigroup to a monoid by using null as the identity value. */
inline fun <T: Any> nullIdentityCombiner(crossinline combiner: (T, T) -> T): (T?, T?) -> T? = { a, b ->
    when {
        a == null -> b
        b == null -> a
        else -> combiner(a, b)
    }
}

fun ModIntArray.inverseOfEach(): ModIntArray {
    if(isEmpty()) return this
    var acc = ModInt(1)
    val res = ModIntArray(size) { i ->
        acc *= this[i]
        acc
    }
    acc = res[lastIndex].inv_unmemoized()
    for(i in lastIndex downTo 1) {
        res[i] = acc * res[i-1]
        acc *= this[i]
    }
    res[0] = acc

    return res
}

const val MOD = 998244353
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

//@JvmField var _random: Random? = null
val random = Random(0x594E215C123 * System.nanoTime())

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.PriorityQueue
import java.util.StringTokenizer
import java.util.TreeMap
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val percent = ModInt(100).inverse()

    val n = readInt()
    val pipes = List(n) { Pipe(readInt(), readInt(), percent * readInt()) }
    val tree = SegmentTree(n, null, nullIdentityCombiner(Seg::plus))

    tree.build { i ->
        Seg(
            ll = pipes[i].p.not(),
            lr = ModInt(0),
            rl = ModInt(0),
            rr = pipes[i].p,
            ban = NONE
        )
    }

    val cols = ArrayList<Collision>(2*n)

    for(i in 0 until n-1) {
        val a = pipes[i]
        val b = pipes[i+1]

        val d = b.x - a.x
        cols.add(Collision(i, RL, d, a.v + b.v))
        if(a.v > b.v) cols.add(Collision(i, RR, d, a.v - b.v))
        else if(a.v < b.v) cols.add(Collision(i, LL, d, b.v - a.v))
    }

    cols.sortWith(Collision.comparator)

    var currProb = ModInt(1)
    var ans = ModInt(0)
    for((a, t, d, v) in cols) {
        tree[a] = tree[a]!!.copy(ban = t)
        val prob = tree.root!!.sum
        ans += (currProb - prob) * d / v
        currProb = prob
    }

    println(ans.int)
}

inline fun ModInt.not() = ModInt(1) - this

data class Pipe(val x: Int, val v: Int, val p: ModInt)
data class Collision(val a: Int, val type: CollisionType, val d: Int, val v: Int) {
    companion object {
        val comparator = Comparator<Collision> { a, b ->
            (a.d.toLong() * b.v).compareTo(b.d.toLong() * a.v)
        }
    }

    inline val b get() = a + 1
}

inline class CollisionType(val i: Int)
inline val NONE get() = CollisionType(0)
inline val LL get() = CollisionType(1)
inline val RL get() = CollisionType(2)
inline val RR get() = CollisionType(3)

data class Seg(val ll: ModInt, val lr: ModInt, val rl: ModInt, val rr: ModInt, val ban: CollisionType) {
    val sum get() = ll + lr + rl + rr

    operator fun plus(b: Seg): Seg {
        // LR never banned
        var cll = ll * b.rl
        var clr = ll * b.rr
        var crl = rl * b.rl
        var crr = rl * b.rr

        // any ban implies RL banned
        if(ban.i == NONE.i) {
            cll += lr * b.ll
            clr += lr * b.lr
            crl += rr * b.ll
            crr += rr * b.lr
        }

        if(ban.i != LL.i) {
            cll += ll * b.ll
            clr += ll * b.lr
            crl += rl * b.ll
            crr += rl * b.lr
        }

        if(ban.i != RR.i) {
            cll += lr * b.rl
            clr += lr * b.rr
            crl += rr * b.rl
            crr += rr * b.rr
        }

        return Seg(cll, clr, crl, crr, b.ban)
    }
}

class SegmentTree<T>(
    val size: Int,
    val identityValue: T,
    val combiner: (T, T) -> T) {

    private val tsize get() = if(size <= 1) size else Integer.highestOneBit(size - 1) shl 1

    /* degenericization helpers
    val identityValue: T = TODO()
    fun combiner(a: T, b: T): T = TODO()
    */

    @Suppress("UNCHECKED_CAST")
    private val array = Array<Any?>(2 * tsize) { identityValue } as Array<T>

    val root get() = array[1]

    inline val lastIndex get() = size - 1
    inline val indices get() = 0 until size
    val asList: List<T> by lazy {
        object : AbstractList<T>() {
            override val size: Int get() = this@SegmentTree.size
            override fun get(index: Int): T = this@SegmentTree[index]
        }
    }

    fun build(generator: (Int) -> T) {
        for(i in 0 until size) {
            array[i + tsize] = generator(i)
        }
        for(i in tsize-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** instantiates values from an iterable, O(n) time */
    fun copyFrom(iterable: Iterable<T>) {
        run {
            iterable.forEachIndexed { i, t ->
                if(i > lastIndex) return@run
                array[i + tsize] = t
            }
        }
        for(i in tsize-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Updates a value, O(log n) time */
    operator fun set(index: Int, value: T) {
        require(index in 0 until size)
        var i = index + tsize
        array[i] = value
        while(true) {
            i = i shr 1
            if(i <= 0) break
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Gets a value by its index, O(1) time */
    operator fun get(index: Int): T {
        require(index in 0 until size)
        return array[index + tsize]
    }

    /** gets the result of applying the monoid operation to the values in the index range, O(log n) time */
    operator fun get(start: Int, endExclusive: Int): T {
        var l = maxOf(start, 0) + tsize
        var r = minOf(endExclusive, size) + tsize

        // two accumulators to support non-commutative monoids
        var lAcc = identityValue
        var rAcc = identityValue

        while(l < r) {
            if(l and 1 == 1) {
                lAcc = combiner(lAcc, array[l++])
            }
            if(r and 1 == 1) {
                rAcc = combiner(array[--r], rAcc)
            }

            l = l shr 1
            r = r shr 1
        }

        return combiner(lAcc, rAcc)
    }

    operator fun get(range: IntRange) = get(range.first, range.last + 1)
}

/** Converts a semigroup to a monoid by using null as the identity value. */
inline fun <T: Any> nullIdentityCombiner(crossinline combiner: (T, T) -> T): (T?, T?) -> T? = { a, b ->
    when {
        a == null -> b
        b == null -> a
        else -> combiner(a, b)
    }
}

const val MOD = 998244353
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.PriorityQueue
import java.util.StringTokenizer
import java.util.TreeMap
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val percent = ModInt(100).inverse()

    val n = readInt()
    val pipes = List(n) { Pipe(readInt(), readInt(), percent * readInt()) }

    val tree = SegmentTree(n-1, null, nullIdentityCombiner(Seg::plus))

    tree.build { i ->
        Seg(
            ll = pipes[i].p.not() * pipes[i+1].p.not(),
            lr = pipes[i].p.not() * pipes[i+1].p,
            rl = pipes[i].p * pipes[i+1].p.not(),
            rr = pipes[i].p * pipes[i+1].p
        )
    }

    val cols = ArrayList<Collision>(2*n)

    for(i in 0 until n-1) {
        val a = pipes[i]
        val b = pipes[i+1]

        val d = b.x - a.x
        cols.add(Collision(i, RL, d, a.v + b.v))
        if(a.v > b.v) cols.add(Collision(i, RR, d, a.v - b.v))
        else if(a.v < b.v) cols.add(Collision(i, LL, d, b.v - a.v))
    }

    cols.sortWith(Collision.comparator)

    var currProb = ModInt(1)
    var ans = ModInt(0)
    for((a, t, d, v) in cols) {
        tree[a] = tree[a]!!.ban(t)
        val prob = tree[0, tree.size]!!.sum
        ans += (currProb - prob) * d / v
        currProb = prob
    }

    println(ans.int)
}

inline fun ModInt.not() = ModInt(1) - this

data class Pipe(val x: Int, val v: Int, val p: ModInt)
data class Collision(val a: Int, val type: CollisionType, val d: Int, val v: Int) {
    companion object {
        val comparator = Comparator<Collision> { a, b ->
            (a.d.toLong() * b.v).compareTo(b.d.toLong() * a.v)
        }
    }

    inline val b get() = a + 1
}

inline class CollisionType(val i: Int)
inline val LL get() = CollisionType(0)
inline val LR get() = CollisionType(1)
inline val RL get() = CollisionType(2)
inline val RR get() = CollisionType(3)

class Seg(private val values: IntArray) {
    constructor(ll: ModInt, lr: ModInt, rl: ModInt, rr: ModInt): this(intArrayOf(ll.int, lr.int, rl.int, rr.int))

    operator fun get(collisionType: CollisionType) = ModInt(values[collisionType.i])
    val ll get() = ModInt(values[0])
    val lr get() = ModInt(values[1])
    val rl get() = ModInt(values[2])
    val rr get() = ModInt(values[3])

    operator fun plus(b: Seg): Seg {
        val al = ll + lr
        val ar = rl + rr
        val bl = b.ll + b.rl
        val br = b.lr + b.rr

        return Seg(
            ll = al * bl,
            lr = al * br,
            rl = ar * bl,
            rr = ar * br
        )
    }

    val sum get() = ModIntArray(values).sum()

    fun ban(collisionType: CollisionType) = Seg(values.copyOf().also { it[collisionType.i] = 0 })
}

class SegmentTree<T>(
    val size: Int,
    val identityValue: T,
    val combiner: (T, T) -> T) {

    /* degenericization helpers
    val identityValue: T = TODO()
    fun combiner(a: T, b: T): T = TODO()
    */

    @Suppress("UNCHECKED_CAST")
    private val array = Array<Any?>(2 * size) { identityValue } as Array<T>

    inline val lastIndex get() = size - 1
    inline val indices get() = 0 until size
    val asList: List<T> by lazy {
        object : AbstractList<T>() {
            override val size: Int get() = this@SegmentTree.size
            override fun get(index: Int): T = this@SegmentTree[index]
        }
    }

    fun build(generator: (Int) -> T) {
        for(i in 0 until size) {
            array[i + size] = generator(i)
        }
        for(i in size-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** instantiates values from an iterable, O(n) time */
    fun copyFrom(iterable: Iterable<T>) {
        run {
            iterable.forEachIndexed { i, t ->
                if(i > lastIndex) return@run
                array[i + size] = t
            }
        }
        for(i in size-1 downTo 1) {
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Updates a value, O(log n) time */
    operator fun set(index: Int, value: T) {
        require(index in 0 until size)
        var i = index + size
        array[i] = value
        while(true) {
            i = i shr 1
            if(i <= 0) break
            array[i] = combiner(array[i shl 1], array[i shl 1 or 1])
        }
    }

    /** Gets a value by its index, O(1) time */
    operator fun get(index: Int): T {
        require(index in 0 until size)
        return array[index + size]
    }

    /** gets the result of applying the monoid operation to the values in the index range, O(log n) time */
    operator fun get(start: Int, endExclusive: Int): T {
        var l = maxOf(start, 0) + size
        var r = minOf(endExclusive, size) + size

        // two accumulators to support non-commutative monoids
        var lAcc = identityValue
        var rAcc = identityValue

        while(l < r) {
            if(l and 1 == 1) {
                lAcc = combiner(lAcc, array[l++])
            }
            if(r and 1 == 1) {
                rAcc = combiner(array[--r], rAcc)
            }

            l = l shr 1
            r = r shr 1
        }

        return combiner(lAcc, rAcc)
    }

    operator fun get(range: IntRange) = get(range.first, range.last + 1)
}

/** Converts a semigroup to a monoid by using null as the identity value. */
inline fun <T: Any> nullIdentityCombiner(crossinline combiner: (T, T) -> T): (T?, T?) -> T? = { a, b ->
    when {
        a == null -> b
        b == null -> a
        else -> combiner(a, b)
    }
}

const val MOD = 998244353
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

private val MOD = 1_000_000_007
class SegmentTree(n: Int) {
  private val N =
    if (Integer.highestOneBit(n) == n) n
    else Integer.highestOneBit(n) shl 1

  private val zero = 0

  private val dat = IntArray(2 * N){zero}

  private inline fun f(a: Int, b: Int) = run{max(a, b)}

  fun update(i: Int, a: Int) {
    var ix = i + N
    dat[ix] = a
    while(ix > 1) {
      dat[ix shr 1] = f(dat[ix], dat[ix xor 1])
      ix = ix shr 1
    }
  }

  /**
    * [a, b)
    */
  fun query(a: Int, b: Int): Int {
    var res: Int = zero
    var left = a + N
    var right = b - 1 + N

    while(left <= right) {
      if ((left and 1) == 1) res = f(res, dat[left])
      if ((right and 1) == 0) res = f(res, dat[right])
      left = (left + 1) shr 1 // 右の子供なら右の親に移動
      right = (right - 1) shr 1 // 左の子供なら左の親に移動
    }

    return res
  }

  // 条件を満たすか。maxなら '>' minなら '<' が使える
  private inline fun contains(a: Int, x: Int): Boolean = a < x
  /**
   * @param x 左右どちらからか最初に a < x になる場所を探す
   * @param [a, b) 調べる範囲
   * @return -1
   */
  fun find(x: Int, a: Int = 0, b: Int = N, k: Int = 1, l: Int = 0, r: Int = N): Int {
    if (a >= r || l >= b) return -1// ノードが範囲からはずれてる
    if (!contains(dat[k], x)) return -1
    if (l + 1 == r) return l // 0-indexed

    val m = (l + r) / 2
    val lft = k * 2
    val rgt = lft + 1

    // 左から探す。右から探したい場合は左右を逆にすればいい
    val ans = find(x, a, b, lft, l, m)
    if (ans != -1) return ans
    return find(x, a, b, rgt, m, r)
  }
}

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val N = ni()
    val T = ni()
    val (A, M) = run {
      val A = na(N)
      val B = A.distinct() as MutableList<Int>
      B.sort()
      Pair(A.map{B.indexOf(it)}.toIntArray(), B.size)
    }

    debug(A)
    debug{"M:$M"}

    fun simulate(t: Int, s: Int): IntArray {
      debug{"simulate($t $s)"}
      val dp = SegmentTree(M - s)
      for (times in 0 until t) {
        for (a in A) {
          if (a < s) continue
          dp.update(a - s, dp.query(0, a - s + 1) + 1)
        }
      }
      val res = IntArray(M)
      for (i in 0 until M - s) {
        res[i + s] = dp.query(i, i + 1)
      }
      return res
    }

    val SIM_LEN = 1000
    var ans = 0L
    if (T <= SIM_LEN * 2) {
      ans = simulate(T, 0).max()!!.toLong()
    } else {
      val pre = simulate(SIM_LEN, 0)
      for (i in 0 until M) {
        val med = A.count{it == i} * (T - SIM_LEN * 2).toLong()
        val post = simulate(SIM_LEN, i)
        debug(pre)
        debug(post)
        ans = max(ans, pre[i] + med + post.max()!!)
      }
    }

    out.println(ans)
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


import java.util.*
import kotlin.system.exitProcess

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    var a = sc.nextInt()
    var b = sc.nextInt()
    var c = sc.nextInt()
    a *= 10
    for(i in 1..100000) {
        if(c == (a / b) % 10) {
            println(i)
            exitProcess(0)
        }
        a *= 10
    }
    println(-1)
}


import kotlin.math.max

fun getMaxTotalCost(a: Int, b: Int, c: Int, d: Int,
                    firstTypeCost: Int, secondTypeCost: Int): Int {
    var firstCost = 0
    var secondCost = 0

    if (a>0 && d>0) {
        firstCost = firstTypeCost + getMaxTotalCost(a-1, b, c, d-1,
            firstTypeCost, secondTypeCost)
    }

    if (b>0 && c>0 && d>0) {
        secondCost = secondTypeCost + getMaxTotalCost(a, b-1, c-1, d-1,
            firstTypeCost, secondTypeCost)
    }

    return max(firstCost, secondCost)
}

fun main() {
    val a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    val c = readLine()!!.toInt()
    val d = readLine()!!.toInt()
    val firstTypeCost = readLine()!!.toInt()
    val secondTypeCost = readLine()!!.toInt()

    val res = getMaxTotalCost(a, b, c, d, firstTypeCost, secondTypeCost)
    println(res)
}


import kotlin.math.*

fun main() {
    var a = readLine()!!.toInt()
    var b = readLine()!!.toInt()
    var c = readLine()!!.toInt()
    var d = readLine()!!.toInt()
    var e = readLine()!!.toInt()
    var f = readLine()!!.toInt()

    var ans = 0
    for (i in 0..d) {
        val sum = min(a, i) * e + min(min(b, c), d - i) * f
        ans = max(ans, sum)
    }

    println(ans)
}


import java.util.*

fun main() {

    val scanner = Scanner(System.`in`)

    val n = scanner.nextInt()

    val list = mutableSetOf<Int>()

    for (i in 0..n - 1) {
        val tmp = scanner.nextInt()
        list.add(tmp)
    }

    if (list.size != 2)
        println("NO")

    val llist = list.toList()
    val f = llist[0]
    val s = llist[1]
    if (f == s) {
        println("YES")
        println("${llist[0]} ${llist[1]}")

    } else {
        println("NO")
    }

}


import kotlin.system.exitProcess

fun main(){
    var n = readLine()!!.toInt()
    var mp = mutableMapOf<Int, Int>()
    for(i in 1..n){
        var a = readLine()!!.toInt()
        if(mp.contains(a)) mp.set(a, mp[a]!! + 1)
        else mp.set(a, 1)
    }
    if(mp.size == 2){
        var s = mp.values.toList()
        if(s[0] == s[1]){
            println("YES")
            s = mp.keys.toList()
            print("${s[0]} ${s[1]}");
            exitProcess(0)
        }
    }
    print("NO")
}


import java.util.*
import kotlin.collections.ArrayList

fun main() {

    val scanner = Scanner(System.`in`)

    val n = scanner.nextInt()

    val list = ArrayList<Pair<Int, Int>>()

    for (i in 0..200) {
        list.add(i to 0)
    }

    for (i in 0 until n) {
        val tmp = scanner.nextInt()
        list[tmp] = list[tmp].first to list[tmp].second + 1
    }

    val nonnull = list
            .filter { it.second != 0 }
            .sortedByDescending { it.second }

    if (nonnull.size!=2) {
        println("NO")
    }

    if (nonnull[0].second == nonnull[1].second) {
        println("YES")
        println("${nonnull[0].first} ${nonnull[1].first}")
    } else {
        println("NO")
    }

}


import kotlin.math.min

fun main() {
    fun readInt() = readLine()!!.toInt()

    val lemons = readInt()
    val apples = readInt()
    val pears = readInt()
    val lemonsSol = min(lemons, min(apples / 2, pears / 4))
    print(7 * lemonsSol)
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    val a = r.readLine()!!.toInt()
    val b = r.readLine()!!.toInt()
    val c = r.readLine()!!.toInt()
    println(minOf(a, b/2, c/4))
}


import java.lang.Long.max
import java.lang.Long.min

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toLong() } // list of ints

fun main() {
    val q = readInt()

    repeat(q) {
        val (a, b, m) = readInts()
        fun f(x: Int) = 1L shl x

        var cur = a
        var sm = a
        var t = 0
        while (sm + 1 < b) {
            cur = sm + 1
            sm += cur
            t++
        }

        val ans = mutableListOf(a)
        sm = a
        for (i in 1 until t) {
            var temp = sm + 1
            val ff = f(t - i)
            val c = min((b - cur)/ ff, m-1)

            cur += c*ff
            temp += c
            ans.add(temp)
            sm += temp
        }
        if (b - cur > m-1)
            print("-1\n")
        else {
            if (a != b)
                ans.add(b)
            print("" + ans.size + " " + ans.joinToString(" ") + "\n")
        }
    }
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val A = na(3)
    A.sort()
    var ans = 0
    while(A[2] - A[0] >= 2) {
      val v = min(A[1], (A[2] - A[0]) / 2)
      if (v == 0) break
      A[2] -= v * 2
      A[1] -= v
      ans += v
      A.sort()
    }
    ans += A[0]
    out.println(ans)
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n, offset) { ni() }
  }

  private inline fun map(n: Int, offset: Int = 0, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i + offset)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun <A, B> pair(a: A, b: B) = RPair(a, b)
data class RPair<A, B>(val _1: A, val _2: B)

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


// $time$
import java.io.BufferedInputStream
import java.io.File
import java.io.PrintWriter
import kotlin.system.measureTimeMillis
import java.util.TreeMap
import java.util.TreeSet

inline fun TIME(f:()->Unit){
    val t = measureTimeMillis(){
        f()
    }
    println("$t ms")
}

object IO{
    private const val BS = 1 shl 16
    private const val NC = 0.toChar()
    private val buf = ByteArray(BS)
    private var bId = 0
    private var size = 0
    private var c = NC

    var warningActive = true
    var fakein = StringBuilder()

    private var IN: BufferedInputStream = BufferedInputStream(System.`in`, BS)
    val OUT: PrintWriter = PrintWriter(System.out)

    private val char: Char
        get() {
            while (bId == size) {
                size = IN.read(buf) // no need for checked exceptions
                if (size == -1) return NC
                bId = 0
            }
            return buf[bId++].toChar()
        }

    fun nextInt(): Int {
        var neg = false
        if (c == NC) c = char
        while (c < '0' || c > '9') {
            if (c == '-') neg = true
            c = char
        }
        var res = 0
        while (c in '0'..'9') {
            res = (res shl 3) + (res shl 1) + (c - '0')
            c = char
        }
        return if (neg) -res else res
    }
    fun nextLong(): Long {
        var neg = false
        if (c == NC) c = char
        while (c < '0' || c > '9') {
            if (c == '-') neg = true
            c = char
        }
        var res = 0L
        while (c in '0'..'9') {
            res = (res shl 3) + (res shl 1) + (c - '0')
            c = char
        }
        return if (neg) -res else res
    }
    fun nextString():String{
        val ret = StringBuilder()
        while (true){
            c = char
            if(!isWhitespace(c)){ break}
        }
        ret.append(c)
        while (true){
            c = char
            if(isWhitespace(c)){ break}
            ret.append(c)
        }
        return ret.toString()
    }
    fun isWhitespace(c:Char):Boolean{
        return c == ' ' || c == '\n' || c == '\r' || c == '\t'
    }
    fun rerouteInput(){
        if(warningActive){
            put("You forgot to disable tests you digital dummy!")
            println("You forgot to disable tests you digital dummy!")
            warningActive = false
        }
        val S = fakein.toString()
        println("New Case ")
        println(S.take(80))
        println("...")
        fakein.clear()
        IN = BufferedInputStream(S.byteInputStream(),BS)
    }
    fun takeFile(name:String){
        IN = BufferedInputStream(File(name).inputStream(),BS)
    }
}
fun put(aa:Any){ IO.OUT.println(aa)}
fun done(){ IO.OUT.close() }
fun share(aa:Any){
    if(aa is IntArray){IO.fakein.append(aa.joinToString(" "))}
    else if(aa is LongArray){IO.fakein.append(aa.joinToString(" "))}
    else if(aa is List<*>){IO.fakein.append(aa.toString())}
    else{IO.fakein.append(aa.toString())}
    IO.fakein.append("\n")
}

val getintfast:Int get() = IO.nextInt()
val getint:Int get(){ val ans = getlong ; if(ans > Int.MAX_VALUE) IntArray(1000000000); return ans.toInt() }
val getlong:Long get() = IO.nextLong()
val getstr:String get() = IO.nextString()
fun getline(n:Int):IntArray{
    return IntArray(n){getint}
}
fun getlineL(n:Int):LongArray{
    return LongArray(n){getlong}
}
fun getbinary(n:Int, asTrue:Char):BooleanArray{
    val str = getstr
    return BooleanArray(n){str[it] == asTrue}
}

val List<Char>.ret:String
get() = this.joinToString("")
var dmark = -1
infix fun Any.dei(a:Any){
    //does not stand for anything it is just easy to type, have to be infix because kotlin does not have custom prefix operators
    dmark++
    var str = "<${dmark}>   "
    debug()
    if(this is String){ str += this
    }else if(this is Int){ str += this.toString()
    }else if(this is Long){ str += this.toString()
    }else{ str += this.toString()}
    if(a is List<*>){ println("$str : ${a.joinToString(" ")}")
    }else if(a is IntArray){ println("$str : ${a.joinToString(" ")}")
    }else if(a is LongArray){ println("$str : ${a.joinToString(" ")}")
    }else if(a is BooleanArray){ println("$str :${a.map{if(it)'1' else '0'}.joinToString(" ")}")
    }else if(a is Array<*>){
        println("$str : ")
        for(c in a){if(c is IntArray){println(c.joinToString(" "))}
        else if(c is LongArray){println(c.joinToString(" "))}
        else if(c is BooleanArray){println(c.map { if(it) '1' else '0' }.joinToString(""))
        }

        }
        println()
    }else{ println("$str : $a")
    }
}
val just = " " // usage: just dei x , where x is the debug variable
fun crash(){
    throw Exception("Bad programme")} // because assertion does not work
fun assert(a:Boolean){
    if(!a){
        throw Exception("Failed Assertion")
    }}
enum class solveMode {
    real, rand, tc
}
object solve{
    var mode:solveMode = solveMode.real
    var tcNum:Int = 0
    var rand:()->Unit = {}
    var TC:MutableMap<Int,()->Unit> = mutableMapOf()
    var answersChecked = 0
    var tn:Long = 0
    fun cases(onecase:()->Unit){
        val t = if(mode == solveMode.real){if(singleCase) 1 else getint} else if(mode == solveMode.tc){1 } else randCount
        //safety checks
        if(pI != 998_244_353 && pI != 1_000_000_007){
            throw Exception("Modding a wrong prime!")
        }
        if(withBruteForce){
            println("Brute force is active")
        }

        if(t == 1 && mode != solveMode.real){
            tn = System.currentTimeMillis()
        }
        repeat(t){
            if(mode == solveMode.tc){
                TC[tcNum]?.let { it() }
                IO.rerouteInput()
            }else if(mode == solveMode.rand){
                rand()
                IO.rerouteInput()
            }
            onecase()
        }
        if(t == 1 && mode != solveMode.real){
            val dt = System.currentTimeMillis() - tn
            println("Time $dt ms ")
        }
    }
    inline fun singleCase(a:solve.()->Unit){
        val t = if(mode != solveMode.rand){1} else randCount
        repeat(t) { a() }
    }
    fun rand(a:()->Unit){
        this.rand = a
    }
    fun tc(id:Int = 0,a:()->Unit){
        TC[id] = a
    }
    fun usetc(a:Int = 0 ){
        this.tcNum = a
        this.mode = solveMode.tc
    }
    fun userand(){
        this.mode = solveMode.rand
    }
}
inline fun<T> T.alsoBrute(cal:() -> T){
    if(!withBruteForce) return
    val also = cal()
    if(this != also){
        println("Checking failed: Got ${this} Brute ${also}")
        crash()
    }
}
// 1. Modded
const val p = 1000000007L
const val pI = p.toInt()
fun Int.adjust():Int{ if(this >= pI){ return this  - pI }else if (this < 0){ return this + pI };return this }
fun Int.snap():Int{ if(this >= pI){return this - pI} else return this}
infix fun Int.modM(b:Int):Int{ return ((this.toLong() * b) % pI).toInt() }
infix fun Int.modPlus(b:Int):Int{ val ans = this + b;return if(ans >= pI) ans - pI else ans }
// 2. DP initial values
const val plarge = 1_000_000_727
const val nlarge = -plarge
const val phuge = 2_727_000_000_000_000_000L
const val nhuge = -phuge
// 3. conveniecen conversions
val Boolean.chi:Int get() = if(this) 1 else 0 //characteristic function
val Char.code :Int get() = this.toInt() -  'a'.toInt()
//3. hard to write stuff
fun IntArray.put(i:Int,v:Int){ this[i] = (this[i] + v).adjust() }
val mint:MutableList<Int> get() = mutableListOf<Int>()
val mong:MutableList<Long> get() = mutableListOf<Long>()
//4. more outputs
fun List<Char>.conca():String = this.joinToString("")
val CharArray.conca :String get() = this.joinToString("")
val IntArray.conca :String get() = this.joinToString(" ")
@JvmName("concaInt")
fun List<Int>.conca():String = this.joinToString(" ")
val LongArray.conca:String get() = this.joinToString(" ")
@JvmName("concaLong")
fun List<Long>.conca():String = this.joinToString(" ")
//5. Pair of ints
const val longmask = (1L shl 32) - 1
fun makepair(a:Int, b:Int):Long = (a.toLong() shl 32) xor (longmask and b.toLong()) // remember positev sonly
val Long.first get() = (this ushr 32).toInt()
val Long.second get() = this.toInt()
//6. strings
val String.size get() = this.length
const val randCount = 100
//7. bits
fun Int.has(i:Int):Boolean = (this and (1 shl i) != 0)

fun debug(){}
const val withBruteForce = false
const val singleCase = true
fun main(){
    val t= TreeSet<Int>()
    t.addAll(listOf(1200,1400,1600,1900,2100,2300,2400,2600,3000))
    solve.cases{
        val r = getint
        put(t.higher(r)!!)

    }
    done()
}