Case #1: 2 Case #2: 6 Case #3: 50002 Case #4: 61 Case #5: -1