Case #1: 2 Case #2: -1 Case #3: 1 Case #4: -1 Case #5: 9 Case #6: -1 Case #7: -1 Case #8: 9998 Case #9: 499 Case #10: 501 Case #11: 108 Case #12: 153 Case #13: 315 Case #14: 1008 Case #15: 27 Case #16: 23 Case #17: -1 Case #18: -1 Case #19: 15 Case #20: 32 Case #21: -1 Case #22: 116 Case #23: -1 Case #24: 8887 Case #25: -1 Case #26: 316 Case #27: -1 Case #28: 291 Case #29: 131 Case #30: 16 Case #31: 3999 Case #32: 813 Case #33: 1636 Case #34: 1279 Case #35: 361