package codeforces.round637

fun main() {
	readLn()
	val d = readInts().sorted()
	val (g, r) = readInts()
	val inf = Int.MAX_VALUE
	val mark = Array(g) { BooleanArray(d.size) { false } }
	val queue = Array(g) { IntArray(d.size) }
	val queueLow = IntArray(g)
	val queueHigh = IntArray(g)
	mark[0][0] = true
	queueHigh[0] = 1
	var ans = inf
	var time = 0
	while (time < ans) {
		val mod = time % (g + r)
		repeat(queueHigh[mod] - queueLow[mod]) {
			val i = queue[mod][queueLow[mod]++]
			if (mod + d.last() - d[i] <= g) ans = minOf(ans, time + d.last() - d[i])
			for (i2 in intArrayOf(i - 1, i + 1)) {
				val mod2 = (((d.getOrNull(i2) ?: continue) - d[i]).abs() + mod)
						.let { if (it == g) 0 else it }
				if (mod2 > g || mark[mod2][i2]) continue
				mark[mod2][i2] = true
				queue[mod2][queueHigh[mod2]++] = i2
			}
		}
		if (++time % (g + r) == g) {
			time += r
			if (queueLow[0] == queueHigh[0]) break
		}
	}
	println(if (ans < inf) ans else -1)
}

private fun Int.abs() = kotlin.math.abs(this)
private fun readLn() = readLine()!!
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }

Compiled from "c.kt"
public final class codeforces.round637.CKt {
  public static final void main();
    Code:
       0: invokestatic  #10                 // Method readLn:()Ljava/lang/String;
       3: pop
       4: invokestatic  #14                 // Method readInts:()Ljava/util/List;
       7: checkcast     #16                 // class java/lang/Iterable
      10: invokestatic  #22                 // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
      13: astore_0
      14: invokestatic  #14                 // Method readInts:()Ljava/util/List;
      17: astore_1
      18: aload_1
      19: iconst_0
      20: invokeinterface #28,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      25: checkcast     #30                 // class java/lang/Number
      28: invokevirtual #34                 // Method java/lang/Number.intValue:()I
      31: istore_2
      32: aload_1
      33: iconst_1
      34: invokeinterface #28,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      39: checkcast     #30                 // class java/lang/Number
      42: invokevirtual #34                 // Method java/lang/Number.intValue:()I
      45: istore_3
      46: ldc           #35                 // int 2147483647
      48: istore        4
      50: iconst_0
      51: istore        6
      53: iload_2
      54: anewarray     #37                 // class "[Z"
      57: astore        7
      59: iload         6
      61: iload_2
      62: if_icmpge     130
      65: iload         6
      67: istore        8
      69: aload         7
      71: iload         8
      73: iconst_0
      74: istore        9
      76: aload_0
      77: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
      82: istore        10
      84: iload         10
      86: newarray       boolean
      88: astore        11
      90: istore        26
      92: astore        25
      94: iload         9
      96: iload         10
      98: if_icmpge     117
     101: iload         9
     103: istore        12
     105: aload         11
     107: iload         12
     109: iconst_0
     110: bastore
     111: iinc          9, 1
     114: goto          94
     117: aload         25
     119: iload         26
     121: aload         11
     123: aastore
     124: iinc          6, 1
     127: goto          59
     130: aload         7
     132: astore        5
     134: iconst_0
     135: istore        7
     137: iload_2
     138: anewarray     #42                 // class "[I"
     141: astore        8
     143: iload         7
     145: iload_2
     146: if_icmpge     172
     149: iload         7
     151: istore        9
     153: aload         8
     155: iload         9
     157: aload_0
     158: invokeinterface #40,  1           // InterfaceMethod java/util/List.size:()I
     163: newarray       int
     165: aastore
     166: iinc          7, 1
     169: goto          143
     172: aload         8
     174: astore        6
     176: iload_2
     177: newarray       int
     179: astore        7
     181: iload_2
     182: newarray       int
     184: astore        8
     186: aload         5
     188: iconst_0
     189: aaload
     190: iconst_0
     191: iconst_1
     192: bastore
     193: aload         8
     195: iconst_0
     196: iconst_1
     197: iastore
     198: iconst_0
     199: istore        9
     201: iload         4
     203: istore        9
     205: iconst_0
     206: istore        10
     208: iload         10
     210: iload         9
     212: if_icmpge     561
     215: iload         10
     217: iload_2
     218: iload_3
     219: iadd
     220: irem
     221: istore        11
     223: aload         8
     225: iload         11
     227: iaload
     228: aload         7
     230: iload         11
     232: iaload
     233: isub
     234: istore        12
     236: iconst_0
     237: istore        13
     239: iload         13
     241: iload         12
     243: if_icmpge     525
     246: iload         13
     248: istore        14
     250: iconst_0
     251: istore        15
     253: aload         6
     255: iload         11
     257: aaload
     258: aload         7
     260: iload         11
     262: iaload
     263: istore        16
     265: aload         7
     267: iload         11
     269: iload         16
     271: iconst_1
     272: iadd
     273: iastore
     274: iload         16
     276: iaload
     277: istore        17
     279: iload         11
     281: aload_0
     282: invokestatic  #46                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     285: checkcast     #30                 // class java/lang/Number
     288: invokevirtual #34                 // Method java/lang/Number.intValue:()I
     291: iadd
     292: aload_0
     293: iload         17
     295: invokeinterface #28,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     300: checkcast     #30                 // class java/lang/Number
     303: invokevirtual #34                 // Method java/lang/Number.intValue:()I
     306: isub
     307: iload_2
     308: if_icmpgt     346
     311: iload         9
     313: iload         10
     315: aload_0
     316: invokestatic  #46                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     319: checkcast     #30                 // class java/lang/Number
     322: invokevirtual #34                 // Method java/lang/Number.intValue:()I
     325: iadd
     326: aload_0
     327: iload         17
     329: invokeinterface #28,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     334: checkcast     #30                 // class java/lang/Number
     337: invokevirtual #34                 // Method java/lang/Number.intValue:()I
     340: isub
     341: invokestatic  #52                 // Method java/lang/Math.min:(II)I
     344: istore        9
     346: iconst_2
     347: newarray       int
     349: astore        18
     351: aload         18
     353: iconst_0
     354: iload         17
     356: iconst_1
     357: isub
     358: iastore
     359: aload         18
     361: iconst_1
     362: iload         17
     364: iconst_1
     365: iadd
     366: iastore
     367: aload         18
     369: astore        16
     371: iconst_0
     372: istore        18
     374: aload         16
     376: arraylength
     377: istore        19
     379: iload         18
     381: iload         19
     383: if_icmpge     518
     386: aload         16
     388: iload         18
     390: iaload
     391: istore        20
     393: aload_0
     394: iload         20
     396: invokestatic  #56                 // Method kotlin/collections/CollectionsKt.getOrNull:(Ljava/util/List;I)Ljava/lang/Object;
     399: checkcast     #58                 // class java/lang/Integer
     402: dup
     403: ifnull        412
     406: invokevirtual #59                 // Method java/lang/Integer.intValue:()I
     409: goto          416
     412: pop
     413: goto          512
     416: aload_0
     417: iload         17
     419: invokeinterface #28,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     424: checkcast     #30                 // class java/lang/Number
     427: invokevirtual #34                 // Method java/lang/Number.intValue:()I
     430: isub
     431: invokestatic  #63                 // Method abs:(I)I
     434: iload         11
     436: iadd
     437: istore        21
     439: iconst_0
     440: istore        22
     442: iload         21
     444: iload_2
     445: if_icmpne     452
     448: iconst_0
     449: goto          454
     452: iload         21
     454: nop
     455: istore        23
     457: iload         23
     459: iload_2
     460: if_icmpgt     512
     463: aload         5
     465: iload         23
     467: aaload
     468: iload         20
     470: baload
     471: ifeq          477
     474: goto          512
     477: aload         5
     479: iload         23
     481: aaload
     482: iload         20
     484: iconst_1
     485: bastore
     486: aload         6
     488: iload         23
     490: aaload
     491: aload         8
     493: iload         23
     495: iaload
     496: istore        24
     498: aload         8
     500: iload         23
     502: iload         24
     504: iconst_1
     505: iadd
     506: iastore
     507: iload         24
     509: iload         20
     511: iastore
     512: iinc          18, 1
     515: goto          379
     518: nop
     519: iinc          13, 1
     522: goto          239
     525: iload         10
     527: iconst_1
     528: iadd
     529: istore        10
     531: iload         10
     533: iload_2
     534: iload_3
     535: iadd
     536: irem
     537: iload_2
     538: if_icmpne     208
     541: iload         10
     543: iload_3
     544: iadd
     545: istore        10
     547: aload         7
     549: iconst_0
     550: iaload
     551: aload         8
     553: iconst_0
     554: iaload
     555: if_icmpne     208
     558: goto          561
     561: iload         9
     563: iload         4
     565: if_icmpge     573
     568: iload         9
     570: goto          574
     573: iconst_m1
     574: istore        11
     576: getstatic     #69                 // Field java/lang/System.out:Ljava/io/PrintStream;
     579: iload         11
     581: invokevirtual #75                 // Method java/io/PrintStream.println:(I)V
     584: return

  private static final int abs(int);
    Code:
       0: iload_0
       1: invokestatic  #99                 // Method java/lang/Math.abs:(I)I
       4: ireturn

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #105                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #10                 // Method readLn:()Ljava/lang/String;
       3: checkcast     #115                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #117                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #119                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #125                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: areturn

  private static final java.util.List<java.lang.Integer> readInts();
    Code:
       0: invokestatic  #128                // Method readStrings:()Ljava/util/List;
       3: checkcast     #16                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #130                // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #134                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #137                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #139                // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #143,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #149,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #153,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #117                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #157                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #161                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #165,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #24                 // class java/util/List
      96: nop
      97: areturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #179                // Method main:()V
       3: return
}


package codeforces.kotlinheroes8

import java.util.*

private fun solve() {
	val n = readInt()
	val (from, toIn) = List(2) { readInts() }
	data class Doctor(val id: Int, val from: Int, val to: Int)
	val doctors = List(n) { Doctor(it, from[it], toIn[it] + 1) }
	val low = doctors.sortedBy { it.from }.withIndex().maxOf { it.value.from - it.index }
	val high = doctors.sortedBy { it.to }.withIndex().minOf { it.value.to - it.index }
	if (low >= high) return println(-1)
	val byStart = doctors.groupBy { it.from }
	val queue = PriorityQueue<Doctor>(compareBy({ it.to }, { it.id }))
	queue.addAll(doctors.filter { it.from <= low })
	val ans = (low until low + n).map { time ->
		val doctor = queue.poll()
		if (doctor.to <= time) return println(-1)
		queue.addAll(byStart[time + 1] ?: emptyList())
		doctor.id
	}
	println(low)
	println(ans.map { it + 1 }.joinToString(" "))
}

fun main() = repeat(readInt()) { solve() }

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }

Compiled from "i.kt"
public final class codeforces.kotlinheroes8.IKt$solve$Doctor {
  private final int id;

  private final int from;

  private final int to;

  public codeforces.kotlinheroes8.IKt$solve$Doctor(int, int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field id:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field from:I
      14: aload_0
      15: iload_3
      16: putfield      #19                 // Field to:I
      19: return

  public final int getId();
    Code:
       0: aload_0
       1: getfield      #13                 // Field id:I
       4: ireturn

  public final int getFrom();
    Code:
       0: aload_0
       1: getfield      #16                 // Field from:I
       4: ireturn

  public final int getTo();
    Code:
       0: aload_0
       1: getfield      #19                 // Field to:I
       4: ireturn

  public final int component1();
    Code:
       0: aload_0
       1: getfield      #13                 // Field id:I
       4: ireturn

  public final int component2();
    Code:
       0: aload_0
       1: getfield      #16                 // Field from:I
       4: ireturn

  public final int component3();
    Code:
       0: aload_0
       1: getfield      #19                 // Field to:I
       4: ireturn

  public final codeforces.kotlinheroes8.IKt$solve$Doctor copy(int, int, int);
    Code:
       0: new           #2                  // class codeforces/kotlinheroes8/IKt$solve$Doctor
       3: dup
       4: iload_1
       5: iload_2
       6: iload_3
       7: invokespecial #32                 // Method "<init>":(III)V
      10: areturn

  public static codeforces.kotlinheroes8.IKt$solve$Doctor copy$default(codeforces.kotlinheroes8.IKt$solve$Doctor, int, int, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #13                 // Field id:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field from:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #19                 // Field to:I
      35: istore_3
      36: aload_0
      37: iload_1
      38: iload_2
      39: iload_3
      40: invokevirtual #36                 // Method copy:(III)Lcodeforces/kotlinheroes8/IKt$solve$Doctor;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #40                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #41                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #43                 // String Doctor(id=
       9: invokevirtual #47                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field id:I
      16: invokevirtual #50                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #52                 // String , from=
      21: invokevirtual #47                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field from:I
      28: invokevirtual #50                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #54                 // String , to=
      33: invokevirtual #47                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #19                 // Field to:I
      40: invokevirtual #50                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #57                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #59                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field id:I
       4: invokestatic  #65                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field from:I
      16: invokestatic  #65                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #19                 // Field to:I
      29: invokestatic  #65                 // Method java/lang/Integer.hashCode:(I)I
      32: iadd
      33: istore_1
      34: iload_1
      35: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class codeforces/kotlinheroes8/IKt$solve$Doctor
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class codeforces/kotlinheroes8/IKt$solve$Doctor
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field id:I
      25: aload_2
      26: getfield      #13                 // Field id:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field from:I
      38: aload_2
      39: getfield      #16                 // Field from:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #19                 // Field to:I
      51: aload_2
      52: getfield      #19                 // Field to:I
      55: if_icmpeq     60
      58: iconst_0
      59: ireturn
      60: iconst_1
      61: ireturn
}

Compiled from "i.kt"
public final class codeforces.kotlinheroes8.IKt {
  private static final void solve();
    Code:
       0: invokestatic  #10                 // Method readInt:()I
       3: istore_0
       4: iconst_2
       5: istore_2
       6: new           #12                 // class java/util/ArrayList
       9: dup
      10: iload_2
      11: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
      14: astore_3
      15: iconst_0
      16: istore        4
      18: iload         4
      20: iload_2
      21: if_icmpge     54
      24: iload         4
      26: istore        5
      28: aload_3
      29: iload         5
      31: istore        6
      33: astore        22
      35: iconst_0
      36: istore        7
      38: invokestatic  #20                 // Method readInts:()Ljava/util/List;
      41: aload         22
      43: swap
      44: invokevirtual #24                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      47: pop
      48: iinc          4, 1
      51: goto          18
      54: aload_3
      55: checkcast     #26                 // class java/util/List
      58: astore_1
      59: aload_1
      60: iconst_0
      61: invokeinterface #30,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      66: checkcast     #26                 // class java/util/List
      69: astore_2
      70: aload_1
      71: iconst_1
      72: invokeinterface #30,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      77: checkcast     #26                 // class java/util/List
      80: astore_3
      81: new           #12                 // class java/util/ArrayList
      84: dup
      85: iload_0
      86: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
      89: astore        5
      91: iconst_0
      92: istore        6
      94: iload         6
      96: iload_0
      97: if_icmpge     167
     100: iload         6
     102: istore        7
     104: aload         5
     106: iload         7
     108: istore        8
     110: astore        22
     112: iconst_0
     113: istore        9
     115: new           #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     118: dup
     119: iload         8
     121: aload_2
     122: iload         8
     124: invokeinterface #30,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     129: checkcast     #34                 // class java/lang/Number
     132: invokevirtual #37                 // Method java/lang/Number.intValue:()I
     135: aload_3
     136: iload         8
     138: invokeinterface #30,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     143: checkcast     #34                 // class java/lang/Number
     146: invokevirtual #37                 // Method java/lang/Number.intValue:()I
     149: iconst_1
     150: iadd
     151: invokespecial #40                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor."<init>":(III)V
     154: aload         22
     156: swap
     157: invokevirtual #24                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     160: pop
     161: iinc          6, 1
     164: goto          94
     167: aload         5
     169: checkcast     #26                 // class java/util/List
     172: astore        4
     174: aload         4
     176: checkcast     #42                 // class java/lang/Iterable
     179: astore        6
     181: iconst_0
     182: istore        7
     184: aload         6
     186: new           #44                 // class codeforces/kotlinheroes8/IKt$solve$$inlined$sortedBy$1
     189: dup
     190: invokespecial #46                 // Method codeforces/kotlinheroes8/IKt$solve$$inlined$sortedBy$1."<init>":()V
     193: checkcast     #48                 // class java/util/Comparator
     196: invokestatic  #54                 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     199: checkcast     #42                 // class java/lang/Iterable
     202: invokestatic  #58                 // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     205: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     210: astore        7
     212: aload         7
     214: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     219: ifne          230
     222: new           #70                 // class java/util/NoSuchElementException
     225: dup
     226: invokespecial #71                 // Method java/util/NoSuchElementException."<init>":()V
     229: athrow
     230: aload         7
     232: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     237: checkcast     #77                 // class kotlin/collections/IndexedValue
     240: astore        8
     242: iconst_0
     243: istore        9
     245: aload         8
     247: invokevirtual #80                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     250: checkcast     #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     253: invokevirtual #83                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getFrom:()I
     256: aload         8
     258: invokevirtual #86                 // Method kotlin/collections/IndexedValue.getIndex:()I
     261: isub
     262: istore        8
     264: aload         7
     266: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     271: ifeq          322
     274: aload         7
     276: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     281: checkcast     #77                 // class kotlin/collections/IndexedValue
     284: astore        9
     286: iconst_0
     287: istore        10
     289: aload         9
     291: invokevirtual #80                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     294: checkcast     #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     297: invokevirtual #83                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getFrom:()I
     300: aload         9
     302: invokevirtual #86                 // Method kotlin/collections/IndexedValue.getIndex:()I
     305: isub
     306: istore        9
     308: iload         8
     310: iload         9
     312: if_icmpge     264
     315: iload         9
     317: istore        8
     319: goto          264
     322: iload         8
     324: istore        5
     326: aload         4
     328: checkcast     #42                 // class java/lang/Iterable
     331: astore        7
     333: iconst_0
     334: istore        8
     336: aload         7
     338: new           #88                 // class codeforces/kotlinheroes8/IKt$solve$$inlined$sortedBy$2
     341: dup
     342: invokespecial #89                 // Method codeforces/kotlinheroes8/IKt$solve$$inlined$sortedBy$2."<init>":()V
     345: checkcast     #48                 // class java/util/Comparator
     348: invokestatic  #54                 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     351: checkcast     #42                 // class java/lang/Iterable
     354: invokestatic  #58                 // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     357: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     362: astore        8
     364: aload         8
     366: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     371: ifne          382
     374: new           #70                 // class java/util/NoSuchElementException
     377: dup
     378: invokespecial #71                 // Method java/util/NoSuchElementException."<init>":()V
     381: athrow
     382: aload         8
     384: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     389: checkcast     #77                 // class kotlin/collections/IndexedValue
     392: astore        9
     394: iconst_0
     395: istore        10
     397: aload         9
     399: invokevirtual #80                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     402: checkcast     #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     405: invokevirtual #92                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getTo:()I
     408: aload         9
     410: invokevirtual #86                 // Method kotlin/collections/IndexedValue.getIndex:()I
     413: isub
     414: istore        9
     416: aload         8
     418: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     423: ifeq          474
     426: aload         8
     428: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     433: checkcast     #77                 // class kotlin/collections/IndexedValue
     436: astore        10
     438: iconst_0
     439: istore        11
     441: aload         10
     443: invokevirtual #80                 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     446: checkcast     #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     449: invokevirtual #92                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getTo:()I
     452: aload         10
     454: invokevirtual #86                 // Method kotlin/collections/IndexedValue.getIndex:()I
     457: isub
     458: istore        10
     460: iload         9
     462: iload         10
     464: if_icmple     416
     467: iload         10
     469: istore        9
     471: goto          416
     474: iload         9
     476: istore        6
     478: iload         5
     480: iload         6
     482: if_icmplt     497
     485: iconst_m1
     486: istore        7
     488: getstatic     #98                 // Field java/lang/System.out:Ljava/io/PrintStream;
     491: iload         7
     493: invokevirtual #103                // Method java/io/PrintStream.println:(I)V
     496: return
     497: aload         4
     499: checkcast     #42                 // class java/lang/Iterable
     502: astore        8
     504: iconst_0
     505: istore        9
     507: aload         8
     509: astore        10
     511: new           #105                // class java/util/LinkedHashMap
     514: dup
     515: invokespecial #106                // Method java/util/LinkedHashMap."<init>":()V
     518: checkcast     #108                // class java/util/Map
     521: astore        11
     523: iconst_0
     524: istore        12
     526: aload         10
     528: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     533: astore        13
     535: aload         13
     537: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     542: ifeq          650
     545: aload         13
     547: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     552: astore        14
     554: aload         14
     556: checkcast     #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     559: astore        15
     561: iconst_0
     562: istore        16
     564: aload         15
     566: invokevirtual #83                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getFrom:()I
     569: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     572: astore        17
     574: aload         11
     576: astore        18
     578: iconst_0
     579: istore        19
     581: aload         18
     583: aload         17
     585: invokeinterface #117,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     590: astore        20
     592: aload         20
     594: ifnonnull     629
     597: iconst_0
     598: istore        21
     600: new           #12                 // class java/util/ArrayList
     603: dup
     604: invokespecial #118                // Method java/util/ArrayList."<init>":()V
     607: checkcast     #26                 // class java/util/List
     610: astore        21
     612: aload         18
     614: aload         17
     616: aload         21
     618: invokeinterface #122,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     623: pop
     624: aload         21
     626: goto          631
     629: aload         20
     631: nop
     632: checkcast     #26                 // class java/util/List
     635: astore        15
     637: aload         15
     639: aload         14
     641: invokeinterface #123,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     646: pop
     647: goto          535
     650: aload         11
     652: nop
     653: astore        7
     655: new           #125                // class java/util/PriorityQueue
     658: dup
     659: iconst_2
     660: anewarray     #127                // class kotlin/jvm/functions/Function1
     663: astore        9
     665: aload         9
     667: iconst_0
     668: invokedynamic #145,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     673: aastore
     674: aload         9
     676: iconst_1
     677: invokedynamic #150,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
     682: aastore
     683: aload         9
     685: invokestatic  #156                // Method kotlin/comparisons/ComparisonsKt.compareBy:([Lkotlin/jvm/functions/Function1;)Ljava/util/Comparator;
     688: invokespecial #159                // Method java/util/PriorityQueue."<init>":(Ljava/util/Comparator;)V
     691: astore        8
     693: aload         8
     695: aload         4
     697: checkcast     #42                 // class java/lang/Iterable
     700: astore        9
     702: astore        22
     704: iconst_0
     705: istore        10
     707: aload         9
     709: astore        11
     711: new           #12                 // class java/util/ArrayList
     714: dup
     715: invokespecial #118                // Method java/util/ArrayList."<init>":()V
     718: checkcast     #161                // class java/util/Collection
     721: astore        12
     723: iconst_0
     724: istore        13
     726: aload         11
     728: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     733: astore        14
     735: aload         14
     737: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     742: ifeq          795
     745: aload         14
     747: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     752: astore        15
     754: aload         15
     756: checkcast     #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     759: astore        16
     761: iconst_0
     762: istore        17
     764: aload         16
     766: invokevirtual #83                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getFrom:()I
     769: iload         5
     771: if_icmpgt     778
     774: iconst_1
     775: goto          779
     778: iconst_0
     779: ifeq          735
     782: aload         12
     784: aload         15
     786: invokeinterface #162,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     791: pop
     792: goto          735
     795: aload         12
     797: checkcast     #26                 // class java/util/List
     800: nop
     801: aload         22
     803: swap
     804: checkcast     #161                // class java/util/Collection
     807: invokevirtual #166                // Method java/util/PriorityQueue.addAll:(Ljava/util/Collection;)Z
     810: pop
     811: iload         5
     813: iload         5
     815: iload_0
     816: iadd
     817: invokestatic  #172                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     820: checkcast     #42                 // class java/lang/Iterable
     823: astore        10
     825: iconst_0
     826: istore        11
     828: aload         10
     830: astore        12
     832: new           #12                 // class java/util/ArrayList
     835: dup
     836: aload         10
     838: bipush        10
     840: invokestatic  #176                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     843: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
     846: checkcast     #161                // class java/util/Collection
     849: astore        13
     851: iconst_0
     852: istore        14
     854: aload         12
     856: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     861: astore        15
     863: aload         15
     865: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     870: ifeq          986
     873: aload         15
     875: checkcast     #178                // class kotlin/collections/IntIterator
     878: invokevirtual #181                // Method kotlin/collections/IntIterator.nextInt:()I
     881: istore        16
     883: aload         13
     885: iload         16
     887: istore        17
     889: astore        22
     891: iconst_0
     892: istore        18
     894: aload         8
     896: invokevirtual #184                // Method java/util/PriorityQueue.poll:()Ljava/lang/Object;
     899: checkcast     #32                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
     902: astore        19
     904: aload         19
     906: invokevirtual #92                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getTo:()I
     909: iload         17
     911: if_icmpgt     926
     914: iconst_m1
     915: istore        20
     917: getstatic     #98                 // Field java/lang/System.out:Ljava/io/PrintStream;
     920: iload         20
     922: invokevirtual #103                // Method java/io/PrintStream.println:(I)V
     925: return
     926: aload         8
     928: aload         7
     930: iload         17
     932: iconst_1
     933: iadd
     934: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     937: invokeinterface #117,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     942: checkcast     #26                 // class java/util/List
     945: dup
     946: ifnull        955
     949: checkcast     #161                // class java/util/Collection
     952: goto          962
     955: pop
     956: invokestatic  #187                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
     959: checkcast     #161                // class java/util/Collection
     962: invokevirtual #166                // Method java/util/PriorityQueue.addAll:(Ljava/util/Collection;)Z
     965: pop
     966: aload         19
     968: invokevirtual #190                // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getId:()I
     971: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     974: aload         22
     976: swap
     977: invokeinterface #162,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     982: pop
     983: goto          863
     986: aload         13
     988: checkcast     #26                 // class java/util/List
     991: nop
     992: astore        9
     994: getstatic     #98                 // Field java/lang/System.out:Ljava/io/PrintStream;
     997: iload         5
     999: invokevirtual #103                // Method java/io/PrintStream.println:(I)V
    1002: aload         9
    1004: checkcast     #42                 // class java/lang/Iterable
    1007: astore        10
    1009: iconst_0
    1010: istore        11
    1012: aload         10
    1014: astore        12
    1016: new           #12                 // class java/util/ArrayList
    1019: dup
    1020: aload         10
    1022: bipush        10
    1024: invokestatic  #176                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    1027: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
    1030: checkcast     #161                // class java/util/Collection
    1033: astore        13
    1035: iconst_0
    1036: istore        14
    1038: aload         12
    1040: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1045: astore        15
    1047: aload         15
    1049: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1054: ifeq          1102
    1057: aload         15
    1059: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1064: astore        16
    1066: aload         13
    1068: aload         16
    1070: checkcast     #34                 // class java/lang/Number
    1073: invokevirtual #37                 // Method java/lang/Number.intValue:()I
    1076: istore        17
    1078: astore        22
    1080: iconst_0
    1081: istore        18
    1083: iload         17
    1085: iconst_1
    1086: iadd
    1087: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1090: aload         22
    1092: swap
    1093: invokeinterface #162,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1098: pop
    1099: goto          1047
    1102: aload         13
    1104: checkcast     #26                 // class java/util/List
    1107: nop
    1108: checkcast     #42                 // class java/lang/Iterable
    1111: ldc           #192                // String
    1113: checkcast     #194                // class java/lang/CharSequence
    1116: aconst_null
    1117: aconst_null
    1118: iconst_0
    1119: aconst_null
    1120: aconst_null
    1121: bipush        62
    1123: aconst_null
    1124: invokestatic  #198                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
    1127: getstatic     #98                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1130: swap
    1131: invokevirtual #201                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1134: return

  public static final void main();
    Code:
       0: invokestatic  #10                 // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     24
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: invokestatic  #257                // Method solve:()V
      18: iinc          1, 1
      21: goto          6
      24: return

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #265                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #270                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #272                // Method readLn:()Ljava/lang/String;
       3: invokestatic  #276                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #272                // Method readLn:()Ljava/lang/String;
       3: checkcast     #194                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #280                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #192                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #286                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: areturn

  private static final java.util.List<java.lang.Integer> readInts();
    Code:
       0: invokestatic  #289                // Method readStrings:()Ljava/util/List;
       3: checkcast     #42                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #12                 // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #176                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #16                 // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #161                // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #280                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #276                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #162,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #26                 // class java/util/List
      96: nop
      97: areturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #294                // Method main:()V
       3: return

  private static final java.lang.Comparable solve$lambda$7(codeforces.kotlinheroes8.IKt$solve$Doctor);
    Code:
       0: aload_0
       1: invokevirtual #92                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getTo:()I
       4: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
       7: checkcast     #298                // class java/lang/Comparable
      10: areturn

  private static final java.lang.Comparable solve$lambda$8(codeforces.kotlinheroes8.IKt$solve$Doctor);
    Code:
       0: aload_0
       1: invokevirtual #190                // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getId:()I
       4: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
       7: checkcast     #298                // class java/lang/Comparable
      10: areturn
}

Compiled from "Comparisons.kt"
public final class codeforces.kotlinheroes8.IKt$solve$$inlined$sortedBy$2<T> implements java.util.Comparator {
  public codeforces.kotlinheroes8.IKt$solve$$inlined$sortedBy$2();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getTo:()I
      12: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      15: checkcast     #35                 // class java/lang/Comparable
      18: aload_2
      19: checkcast     #23                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
      22: astore_3
      23: astore        5
      25: iconst_0
      26: istore        4
      28: aload_3
      29: invokevirtual #27                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getTo:()I
      32: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      35: aload         5
      37: swap
      38: checkcast     #35                 // class java/lang/Comparable
      41: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      44: ireturn
}

Compiled from "Comparisons.kt"
public final class codeforces.kotlinheroes8.IKt$solve$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public codeforces.kotlinheroes8.IKt$solve$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getFrom:()I
      12: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      15: checkcast     #35                 // class java/lang/Comparable
      18: aload_2
      19: checkcast     #23                 // class codeforces/kotlinheroes8/IKt$solve$Doctor
      22: astore_3
      23: astore        5
      25: iconst_0
      26: istore        4
      28: aload_3
      29: invokevirtual #27                 // Method codeforces/kotlinheroes8/IKt$solve$Doctor.getFrom:()I
      32: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      35: aload         5
      37: swap
      38: checkcast     #35                 // class java/lang/Comparable
      41: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      44: ireturn
}


package codeforces.kotlinheroes8

fun main() {
	val den = 1_000_000.toModular()
	val (n, wid, hei) = readInts()
	val (pSlash, pBackslash) = List(2) { Array(wid + hei + 1) { 1.toModular() } } // prob of being free
	val (vertical, horizontal) = listOf(wid, hei).map { s -> BooleanArray(s + 1).also { it[0] = true; it[s] = true } }
	repeat(n) {
		val (x, y, pIn) = readInts()
		val p = 1 - pIn / den
		vertical[x] = true; horizontal[y] = true
		pBackslash[x + y] *= p; pSlash[x - y + hei] *= p
	}
	val vertices = (wid + 1) * (hei + 1) + wid * hei
	val edgesInitial = vertical.count { it } * hei + horizontal.count { it } * wid
	var ans = (1 - vertices + edgesInitial).toModular()
	for (x in 0..wid) for (y in 0..hei) {
		if (!vertical[x] && !horizontal[y]) ans += pBackslash[x + y] * pSlash[x - y + hei]
		if (x < wid && y < hei) ans += pBackslash[x + y + 1] * pSlash[x - y + hei]
		if (x + 1 <= wid && y - 1 >= 0) ans += 2 * (1 - pBackslash[x + y])
		if (x + 1 <= wid && y + 1 <= hei) ans += 2 * (1 - pSlash[x - y + hei])
	}
	println(ans)
}

private fun Int.toModular() = Modular(this)//toDouble()
private class Modular {
	companion object {
		const val M = 998244353
	}
	val x: Int
	@Suppress("ConvertSecondaryConstructorToPrimary")
	constructor(value: Int) { x = (value % M).let { if (it < 0) it + M else it } }
	operator fun plus(that: Modular) = Modular((x + that.x) % M)
	operator fun minus(that: Modular) = Modular((x + M - that.x) % M)
	operator fun times(that: Modular) = (x.toLong() * that.x % M).toInt().toModular()
	private fun modInverse() = Modular(x.toBigInteger().modInverse(M.toBigInteger()).toInt())
	operator fun div(that: Modular) = times(that.modInverse())
	override fun toString() = x.toString()
}
private operator fun Int.plus(that: Modular) = Modular(this) + that
private operator fun Int.minus(that: Modular) = Modular(this) - that
private operator fun Int.times(that: Modular) = Modular(this) * that
private operator fun Int.div(that: Modular) = Modular(this) / that

private fun readLn() = readLine()!!
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }

Compiled from "h.kt"
public final class codeforces.kotlinheroes8.HKt {
  public static final void main();
    Code:
       0: ldc           #7                  // int 1000000
       2: invokestatic  #11                 // Method toModular:(I)Lcodeforces/kotlinheroes8/Modular;
       5: astore_0
       6: invokestatic  #15                 // Method readInts:()Ljava/util/List;
       9: astore_1
      10: aload_1
      11: iconst_0
      12: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      17: checkcast     #23                 // class java/lang/Number
      20: invokevirtual #27                 // Method java/lang/Number.intValue:()I
      23: istore_2
      24: aload_1
      25: iconst_1
      26: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      31: checkcast     #23                 // class java/lang/Number
      34: invokevirtual #27                 // Method java/lang/Number.intValue:()I
      37: istore_3
      38: aload_1
      39: iconst_2
      40: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      45: checkcast     #23                 // class java/lang/Number
      48: invokevirtual #27                 // Method java/lang/Number.intValue:()I
      51: istore        4
      53: iconst_2
      54: istore        6
      56: new           #29                 // class java/util/ArrayList
      59: dup
      60: iload         6
      62: invokespecial #33                 // Method java/util/ArrayList."<init>":(I)V
      65: astore        7
      67: iconst_0
      68: istore        8
      70: iload         8
      72: iload         6
      74: if_icmpge     151
      77: iload         8
      79: istore        9
      81: aload         7
      83: iload         9
      85: istore        10
      87: astore        21
      89: iconst_0
      90: istore        11
      92: iconst_0
      93: istore        12
      95: iload_3
      96: iload         4
      98: iadd
      99: iconst_1
     100: iadd
     101: istore        13
     103: iload         13
     105: anewarray     #35                 // class codeforces/kotlinheroes8/Modular
     108: astore        14
     110: iload         12
     112: iload         13
     114: if_icmpge     136
     117: iload         12
     119: istore        15
     121: aload         14
     123: iload         15
     125: iconst_1
     126: invokestatic  #11                 // Method toModular:(I)Lcodeforces/kotlinheroes8/Modular;
     129: aastore
     130: iinc          12, 1
     133: goto          110
     136: aload         14
     138: aload         21
     140: swap
     141: invokevirtual #39                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     144: pop
     145: iinc          8, 1
     148: goto          70
     151: aload         7
     153: checkcast     #17                 // class java/util/List
     156: astore        5
     158: aload         5
     160: iconst_0
     161: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     166: checkcast     #41                 // class "[Lcodeforces/kotlinheroes8/Modular;"
     169: astore        6
     171: aload         5
     173: iconst_1
     174: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     179: checkcast     #41                 // class "[Lcodeforces/kotlinheroes8/Modular;"
     182: astore        7
     184: iconst_2
     185: anewarray     #43                 // class java/lang/Integer
     188: astore        9
     190: aload         9
     192: iconst_0
     193: iload_3
     194: invokestatic  #47                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     197: aastore
     198: aload         9
     200: iconst_1
     201: iload         4
     203: invokestatic  #47                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     206: aastore
     207: aload         9
     209: invokestatic  #53                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     212: checkcast     #55                 // class java/lang/Iterable
     215: astore        9
     217: iconst_0
     218: istore        10
     220: aload         9
     222: astore        11
     224: new           #29                 // class java/util/ArrayList
     227: dup
     228: aload         9
     230: bipush        10
     232: invokestatic  #59                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     235: invokespecial #33                 // Method java/util/ArrayList."<init>":(I)V
     238: checkcast     #61                 // class java/util/Collection
     241: astore        12
     243: iconst_0
     244: istore        13
     246: aload         11
     248: invokeinterface #65,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     253: astore        14
     255: aload         14
     257: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     262: ifeq          332
     265: aload         14
     267: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     272: astore        15
     274: aload         12
     276: aload         15
     278: checkcast     #23                 // class java/lang/Number
     281: invokevirtual #27                 // Method java/lang/Number.intValue:()I
     284: istore        16
     286: astore        21
     288: iconst_0
     289: istore        17
     291: iload         16
     293: iconst_1
     294: iadd
     295: newarray       boolean
     297: astore        18
     299: aload         18
     301: astore        19
     303: iconst_0
     304: istore        20
     306: aload         19
     308: iconst_0
     309: iconst_1
     310: bastore
     311: aload         19
     313: iload         16
     315: iconst_1
     316: bastore
     317: aload         18
     319: nop
     320: aload         21
     322: swap
     323: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     328: pop
     329: goto          255
     332: aload         12
     334: checkcast     #17                 // class java/util/List
     337: nop
     338: astore        8
     340: aload         8
     342: iconst_0
     343: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     348: checkcast     #78                 // class "[Z"
     351: astore        9
     353: aload         8
     355: iconst_1
     356: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     361: checkcast     #78                 // class "[Z"
     364: astore        10
     366: iconst_0
     367: istore        11
     369: iload         11
     371: iload_2
     372: if_icmpge     513
     375: iload         11
     377: istore        12
     379: iconst_0
     380: istore        13
     382: invokestatic  #15                 // Method readInts:()Ljava/util/List;
     385: astore        14
     387: aload         14
     389: iconst_0
     390: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     395: checkcast     #23                 // class java/lang/Number
     398: invokevirtual #27                 // Method java/lang/Number.intValue:()I
     401: istore        15
     403: aload         14
     405: iconst_1
     406: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     411: checkcast     #23                 // class java/lang/Number
     414: invokevirtual #27                 // Method java/lang/Number.intValue:()I
     417: istore        16
     419: aload         14
     421: iconst_2
     422: invokeinterface #21,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     427: checkcast     #23                 // class java/lang/Number
     430: invokevirtual #27                 // Method java/lang/Number.intValue:()I
     433: istore        17
     435: iconst_1
     436: iload         17
     438: aload_0
     439: invokestatic  #82                 // Method div:(ILcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     442: invokestatic  #85                 // Method minus:(ILcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     445: astore        18
     447: aload         9
     449: iload         15
     451: iconst_1
     452: bastore
     453: aload         10
     455: iload         16
     457: iconst_1
     458: bastore
     459: iload         15
     461: iload         16
     463: iadd
     464: istore        19
     466: aload         7
     468: iload         19
     470: aload         7
     472: iload         19
     474: aaload
     475: aload         18
     477: invokevirtual #89                 // Method codeforces/kotlinheroes8/Modular.times:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     480: aastore
     481: iload         15
     483: iload         16
     485: isub
     486: iload         4
     488: iadd
     489: istore        19
     491: aload         6
     493: iload         19
     495: aload         6
     497: iload         19
     499: aaload
     500: aload         18
     502: invokevirtual #89                 // Method codeforces/kotlinheroes8/Modular.times:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     505: aastore
     506: nop
     507: iinc          11, 1
     510: goto          369
     513: iload_3
     514: iconst_1
     515: iadd
     516: iload         4
     518: iconst_1
     519: iadd
     520: imul
     521: iload_3
     522: iload         4
     524: imul
     525: iadd
     526: istore        11
     528: aload         9
     530: astore        13
     532: iconst_0
     533: istore        14
     535: iconst_0
     536: istore        15
     538: iconst_0
     539: istore        16
     541: aload         13
     543: arraylength
     544: istore        17
     546: iload         16
     548: iload         17
     550: if_icmpge     581
     553: aload         13
     555: iload         16
     557: baload
     558: istore        18
     560: iload         18
     562: istore        19
     564: iconst_0
     565: istore        20
     567: iload         19
     569: ifeq          575
     572: iinc          15, 1
     575: iinc          16, 1
     578: goto          546
     581: iload         15
     583: iload         4
     585: imul
     586: aload         10
     588: astore        13
     590: istore        21
     592: iconst_0
     593: istore        14
     595: iconst_0
     596: istore        15
     598: iconst_0
     599: istore        16
     601: aload         13
     603: arraylength
     604: istore        17
     606: iload         16
     608: iload         17
     610: if_icmpge     641
     613: aload         13
     615: iload         16
     617: baload
     618: istore        18
     620: iload         18
     622: istore        19
     624: iconst_0
     625: istore        20
     627: iload         19
     629: ifeq          635
     632: iinc          15, 1
     635: iinc          16, 1
     638: goto          606
     641: iload         15
     643: istore        22
     645: iload         21
     647: iload         22
     649: iload_3
     650: imul
     651: iadd
     652: istore        12
     654: iconst_1
     655: iload         11
     657: isub
     658: iload         12
     660: iadd
     661: invokestatic  #11                 // Method toModular:(I)Lcodeforces/kotlinheroes8/Modular;
     664: astore        13
     666: iconst_0
     667: istore        14
     669: iload         14
     671: iload_3
     672: if_icmpgt     880
     675: iconst_0
     676: istore        15
     678: iload         15
     680: iload         4
     682: if_icmpgt     868
     685: aload         9
     687: iload         14
     689: baload
     690: ifne          730
     693: aload         10
     695: iload         15
     697: baload
     698: ifne          730
     701: aload         13
     703: aload         7
     705: iload         14
     707: iload         15
     709: iadd
     710: aaload
     711: aload         6
     713: iload         14
     715: iload         15
     717: isub
     718: iload         4
     720: iadd
     721: aaload
     722: invokevirtual #89                 // Method codeforces/kotlinheroes8/Modular.times:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     725: invokevirtual #92                 // Method codeforces/kotlinheroes8/Modular.plus:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     728: astore        13
     730: iload         14
     732: iload_3
     733: if_icmpge     774
     736: iload         15
     738: iload         4
     740: if_icmpge     774
     743: aload         13
     745: aload         7
     747: iload         14
     749: iload         15
     751: iadd
     752: iconst_1
     753: iadd
     754: aaload
     755: aload         6
     757: iload         14
     759: iload         15
     761: isub
     762: iload         4
     764: iadd
     765: aaload
     766: invokevirtual #89                 // Method codeforces/kotlinheroes8/Modular.times:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     769: invokevirtual #92                 // Method codeforces/kotlinheroes8/Modular.plus:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     772: astore        13
     774: iload         14
     776: iconst_1
     777: iadd
     778: iload_3
     779: if_icmpgt     812
     782: iload         15
     784: iconst_1
     785: isub
     786: iflt          812
     789: aload         13
     791: iconst_2
     792: iconst_1
     793: aload         7
     795: iload         14
     797: iload         15
     799: iadd
     800: aaload
     801: invokestatic  #85                 // Method minus:(ILcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     804: invokestatic  #94                 // Method times:(ILcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     807: invokevirtual #92                 // Method codeforces/kotlinheroes8/Modular.plus:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     810: astore        13
     812: iload         14
     814: iconst_1
     815: iadd
     816: iload_3
     817: if_icmpgt     855
     820: iload         15
     822: iconst_1
     823: iadd
     824: iload         4
     826: if_icmpgt     855
     829: aload         13
     831: iconst_2
     832: iconst_1
     833: aload         6
     835: iload         14
     837: iload         15
     839: isub
     840: iload         4
     842: iadd
     843: aaload
     844: invokestatic  #85                 // Method minus:(ILcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     847: invokestatic  #94                 // Method times:(ILcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     850: invokevirtual #92                 // Method codeforces/kotlinheroes8/Modular.plus:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
     853: astore        13
     855: iload         15
     857: iload         4
     859: if_icmpeq     868
     862: iinc          15, 1
     865: goto          685
     868: iload         14
     870: iload_3
     871: if_icmpeq     880
     874: iinc          14, 1
     877: goto          675
     880: getstatic     #100                // Field java/lang/System.out:Ljava/io/PrintStream;
     883: aload         13
     885: invokevirtual #106                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     888: return

  private static final codeforces.kotlinheroes8.Modular toModular(int);
    Code:
       0: new           #35                 // class codeforces/kotlinheroes8/Modular
       3: dup
       4: iload_0
       5: invokespecial #146                // Method codeforces/kotlinheroes8/Modular."<init>":(I)V
       8: areturn

  private static final codeforces.kotlinheroes8.Modular plus(int, codeforces.kotlinheroes8.Modular);
    Code:
       0: new           #35                 // class codeforces/kotlinheroes8/Modular
       3: dup
       4: iload_0
       5: invokespecial #146                // Method codeforces/kotlinheroes8/Modular."<init>":(I)V
       8: aload_1
       9: invokevirtual #92                 // Method codeforces/kotlinheroes8/Modular.plus:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
      12: areturn

  private static final codeforces.kotlinheroes8.Modular minus(int, codeforces.kotlinheroes8.Modular);
    Code:
       0: new           #35                 // class codeforces/kotlinheroes8/Modular
       3: dup
       4: iload_0
       5: invokespecial #146                // Method codeforces/kotlinheroes8/Modular."<init>":(I)V
       8: aload_1
       9: invokevirtual #151                // Method codeforces/kotlinheroes8/Modular.minus:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
      12: areturn

  private static final codeforces.kotlinheroes8.Modular times(int, codeforces.kotlinheroes8.Modular);
    Code:
       0: new           #35                 // class codeforces/kotlinheroes8/Modular
       3: dup
       4: iload_0
       5: invokespecial #146                // Method codeforces/kotlinheroes8/Modular."<init>":(I)V
       8: aload_1
       9: invokevirtual #89                 // Method codeforces/kotlinheroes8/Modular.times:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
      12: areturn

  private static final codeforces.kotlinheroes8.Modular div(int, codeforces.kotlinheroes8.Modular);
    Code:
       0: new           #35                 // class codeforces/kotlinheroes8/Modular
       3: dup
       4: iload_0
       5: invokespecial #146                // Method codeforces/kotlinheroes8/Modular."<init>":(I)V
       8: aload_1
       9: invokevirtual #155                // Method codeforces/kotlinheroes8/Modular.div:(Lcodeforces/kotlinheroes8/Modular;)Lcodeforces/kotlinheroes8/Modular;
      12: areturn

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #163                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #168                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final java.util.List<java.lang.String> readStrings();
    Code:
       0: invokestatic  #172                // Method readLn:()Ljava/lang/String;
       3: checkcast     #174                // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #176                // class java/lang/String
      10: astore_0
      11: aload_0
      12: iconst_0
      13: ldc           #178                // String
      15: aastore
      16: aload_0
      17: iconst_0
      18: iconst_0
      19: bipush        6
      21: aconst_null
      22: invokestatic  #184                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      25: areturn

  private static final java.util.List<java.lang.Integer> readInts();
    Code:
       0: invokestatic  #187                // Method readStrings:()Ljava/util/List;
       3: checkcast     #55                 // class java/lang/Iterable
       6: astore_0
       7: iconst_0
       8: istore_1
       9: aload_0
      10: astore_2
      11: new           #29                 // class java/util/ArrayList
      14: dup
      15: aload_0
      16: bipush        10
      18: invokestatic  #59                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #33                 // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #61                 // class java/util/Collection
      27: astore_3
      28: iconst_0
      29: istore        4
      31: aload_2
      32: invokeinterface #65,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      37: astore        5
      39: aload         5
      41: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      46: ifeq          92
      49: aload         5
      51: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      56: astore        6
      58: aload_3
      59: aload         6
      61: checkcast     #176                // class java/lang/String
      64: astore        7
      66: astore        9
      68: iconst_0
      69: istore        8
      71: aload         7
      73: invokestatic  #191                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: nop
      77: invokestatic  #47                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aload         9
      82: swap
      83: invokeinterface #76,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          39
      92: aload_3
      93: checkcast     #17                 // class java/util/List
      96: nop
      97: areturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #196                // Method main:()V
       3: return

  public static final codeforces.kotlinheroes8.Modular access$toModular(int);
    Code:
       0: iload_0
       1: invokestatic  #11                 // Method toModular:(I)Lcodeforces/kotlinheroes8/Modular;
       4: areturn
}


package codeforces.kotlinheroes8

private fun solve(): Int {
	val n = readInt()
	val s = readLn().map { "()".indexOf(it) }
	val a = readLn()
	val must = IntArray(n) { -1 }
	val diff = BooleanArray(n)
	for (i in a.indices) {
		if (a[i] == '0') continue
		if (must[i] == 1) return -1
		must[i] = 0
		must[i + 3] = 1
		diff[i + 2] = true
	}
	val inf = n + 1
	val ans = s.indices.fold(listOf(0, 0)) { prev, i -> List(2) { j ->
		if (must[i] == 1 - j) inf else
			(s[i] xor j) + if (diff[i]) prev[1 - j] else prev.minOrNull()!!
	}}.minOrNull()!!
	return if (ans >= inf) -1 else ans
}

fun main() = repeat(readInt()) { println(solve()) }

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

Compiled from "e.kt"
public final class codeforces.kotlinheroes8.EKt {
  private static final int solve();
    Code:
       0: invokestatic  #9                  // Method readInt:()I
       3: istore_0
       4: invokestatic  #13                 // Method readLn:()Ljava/lang/String;
       7: checkcast     #15                 // class java/lang/CharSequence
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #17                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: invokeinterface #20,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      26: invokespecial #24                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #26                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: iconst_0
      38: istore        7
      40: iload         7
      42: aload         4
      44: invokeinterface #20,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      49: if_icmpge     107
      52: aload         4
      54: iload         7
      56: invokeinterface #30,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      61: istore        8
      63: aload         5
      65: iload         8
      67: istore        9
      69: astore        23
      71: iconst_0
      72: istore        10
      74: ldc           #32                 // String ()
      76: checkcast     #15                 // class java/lang/CharSequence
      79: iload         9
      81: iconst_0
      82: iconst_0
      83: bipush        6
      85: aconst_null
      86: invokestatic  #38                 // Method kotlin/text/StringsKt.indexOf$default:(Ljava/lang/CharSequence;CIZILjava/lang/Object;)I
      89: invokestatic  #44                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      92: aload         23
      94: swap
      95: invokeinterface #48,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     100: pop
     101: iinc          7, 1
     104: goto          40
     107: aload         5
     109: checkcast     #50                 // class java/util/List
     112: nop
     113: astore_1
     114: invokestatic  #13                 // Method readLn:()Ljava/lang/String;
     117: astore_2
     118: iconst_0
     119: istore        4
     121: iload_0
     122: newarray       int
     124: astore        5
     126: iload         4
     128: iload_0
     129: if_icmpge     148
     132: iload         4
     134: istore        6
     136: aload         5
     138: iload         6
     140: iconst_m1
     141: iastore
     142: iinc          4, 1
     145: goto          126
     148: aload         5
     150: astore_3
     151: iload_0
     152: newarray       boolean
     154: astore        4
     156: iconst_0
     157: istore        5
     159: aload_2
     160: checkcast     #15                 // class java/lang/CharSequence
     163: invokeinterface #20,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     168: istore        6
     170: iload         5
     172: iload         6
     174: if_icmpge     224
     177: aload_2
     178: iload         5
     180: invokevirtual #53                 // Method java/lang/String.charAt:(I)C
     183: bipush        48
     185: if_icmpeq     218
     188: aload_3
     189: iload         5
     191: iaload
     192: iconst_1
     193: if_icmpne     198
     196: iconst_m1
     197: ireturn
     198: aload_3
     199: iload         5
     201: iconst_0
     202: iastore
     203: aload_3
     204: iload         5
     206: iconst_3
     207: iadd
     208: iconst_1
     209: iastore
     210: aload         4
     212: iload         5
     214: iconst_2
     215: iadd
     216: iconst_1
     217: bastore
     218: iinc          5, 1
     221: goto          170
     224: iload_0
     225: iconst_1
     226: iadd
     227: istore        5
     229: aload_1
     230: checkcast     #26                 // class java/util/Collection
     233: invokestatic  #59                 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     236: checkcast     #61                 // class java/lang/Iterable
     239: astore        7
     241: iconst_2
     242: anewarray     #40                 // class java/lang/Integer
     245: astore        8
     247: aload         8
     249: iconst_0
     250: iconst_0
     251: invokestatic  #44                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     254: aastore
     255: aload         8
     257: iconst_1
     258: iconst_0
     259: invokestatic  #44                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     262: aastore
     263: aload         8
     265: invokestatic  #65                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     268: astore        8
     270: iconst_0
     271: istore        9
     273: aload         8
     275: astore        10
     277: aload         7
     279: invokeinterface #69,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     284: astore        11
     286: aload         11
     288: invokeinterface #75,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     293: ifeq          463
     296: aload         11
     298: checkcast     #77                 // class kotlin/collections/IntIterator
     301: invokevirtual #80                 // Method kotlin/collections/IntIterator.nextInt:()I
     304: istore        12
     306: aload         10
     308: iload         12
     310: istore        13
     312: astore        14
     314: iconst_0
     315: istore        15
     317: iconst_2
     318: istore        16
     320: new           #17                 // class java/util/ArrayList
     323: dup
     324: iload         16
     326: invokespecial #24                 // Method java/util/ArrayList."<init>":(I)V
     329: astore        17
     331: iconst_0
     332: istore        18
     334: iload         18
     336: iload         16
     338: if_icmpge     452
     341: iload         18
     343: istore        19
     345: aload         17
     347: iload         19
     349: istore        20
     351: astore        21
     353: iconst_0
     354: istore        22
     356: aload_3
     357: iload         13
     359: iaload
     360: iconst_1
     361: iload         20
     363: isub
     364: if_icmpne     372
     367: iload         5
     369: goto          436
     372: aload_1
     373: iload         13
     375: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     380: checkcast     #86                 // class java/lang/Number
     383: invokevirtual #89                 // Method java/lang/Number.intValue:()I
     386: iload         20
     388: ixor
     389: aload         4
     391: iload         13
     393: baload
     394: ifeq          417
     397: aload         14
     399: iconst_1
     400: iload         20
     402: isub
     403: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     408: checkcast     #86                 // class java/lang/Number
     411: invokevirtual #89                 // Method java/lang/Number.intValue:()I
     414: goto          435
     417: aload         14
     419: checkcast     #61                 // class java/lang/Iterable
     422: invokestatic  #93                 // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     425: dup
     426: invokestatic  #99                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     429: checkcast     #86                 // class java/lang/Number
     432: invokevirtual #89                 // Method java/lang/Number.intValue:()I
     435: iadd
     436: invokestatic  #44                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     439: aload         21
     441: swap
     442: invokevirtual #100                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     445: pop
     446: iinc          18, 1
     449: goto          334
     452: aload         17
     454: checkcast     #50                 // class java/util/List
     457: nop
     458: astore        10
     460: goto          286
     463: aload         10
     465: checkcast     #61                 // class java/lang/Iterable
     468: invokestatic  #93                 // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     471: dup
     472: invokestatic  #99                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     475: checkcast     #86                 // class java/lang/Number
     478: invokevirtual #89                 // Method java/lang/Number.intValue:()I
     481: istore        6
     483: iload         6
     485: iload         5
     487: if_icmplt     494
     490: iconst_m1
     491: goto          496
     494: iload         6
     496: ireturn

  public static final void main();
    Code:
       0: invokestatic  #9                  // Method readInt:()I
       3: istore_0
       4: iconst_0
       5: istore_1
       6: iload_1
       7: iload_0
       8: if_icmpge     35
      11: iload_1
      12: istore_2
      13: iconst_0
      14: istore_3
      15: invokestatic  #141                // Method solve:()I
      18: istore        4
      20: getstatic     #147                // Field java/lang/System.out:Ljava/io/PrintStream;
      23: iload         4
      25: invokevirtual #152                // Method java/io/PrintStream.println:(I)V
      28: nop
      29: iinc          1, 1
      32: goto          6
      35: return

  private static final java.lang.String readLn();
    Code:
       0: invokestatic  #158                // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: invokestatic  #99                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: areturn

  private static final int readInt();
    Code:
       0: invokestatic  #13                 // Method readLn:()Ljava/lang/String;
       3: invokestatic  #162                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       6: ireturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #165                // Method main:()V
       3: return
}