(String[] args)
| 105 | } |
| 106 | |
| 107 | public static void main(String[] args) throws IOException { |
| 108 | Kattio io = new Kattio(); |
| 109 | h = io.nextLong() - 1; |
| 110 | x = io.nextInt(); |
| 111 | y = io.nextInt(); |
| 112 | z = io.nextInt(); |
| 113 | prepare(); |
| 114 | for (int i = 0; i < x; i++) { |
| 115 | addEdge(i, (i + y) % x, y); |
| 116 | addEdge(i, (i + z) % x, z); |
| 117 | } |
| 118 | io.println(compute()); |
| 119 | io.flush(); |
| 120 | io.close(); |
| 121 | } |
| 122 | |
| 123 | // Kattio类IO效率很好,但还是不如StreamTokenizer |
| 124 | // 只有StreamTokenizer无法正确处理时,才考虑使用这个类 |