Case #1: 2 Case #2: 6 Case #3: 50002 Case #4: 61 Case #5: -1 Case #6: -1 Case #7: 1 Case #8: 25 Case #9: 161 Case #10: 988 Case #11: 1 Case #12: 100002 Case #13: 32183 Case #14: 49898 Case #15: 120004 Case #16: 498 Case #17: 1 Case #18: 82 Case #19: 16 Case #20: 14213 Case #21: 838 Case #22: 3291 Case #23: 47541 Case #24: 1 Case #25: 35958 Case #26: 3 Case #27: 2582 Case #28: 382 Case #29: 1 Case #30: 0