+import java.util.Random;
+import java.util.Scanner;
+
+public class PlayerCheatSmart {
+ public static void main(String[] args) {
+ Scanner in = new Scanner(System.in);
+ Random random = new Random();
+
+ int roadLength = in.nextInt();
+ int initialStones = in.nextInt();
+ in.nextLine();
+
+ while (true) {
+ int trollDistance = in.nextInt();
+ int stones = in.nextInt();
+ int opponentStones = in.nextInt();
+
+ int wantThrow = (roadLength - trollDistance + stones - 1) / stones;
+ int actualThrow = wantThrow > stones ? Integer.MIN_VALUE + 1
+ : wantThrow;
+ System.out.println(actualThrow);
+ }
+ }
+}