Problem:
Score : 700 points

Problem Statement

Determine if there exists a sequence obtained by permuting 1,2,...,N that satisfies the following conditions:

The length of its longest increasing subsequence is A.

The length of its longest decreasing subsequence is B.

If it exists, construct one such sequence.

Notes

A subsequence of a sequence P is a sequence that can be obtained by extracting some of the elements in P without changing the order.

A longest increasing subsequence of a sequence P is a sequence with the maximum length among the subsequences of P that are monotonically increasing.

Similarly, a longest decreasing subsequence of a sequence P is a sequence with the maximum length among the subsequences of P that are monotonically decreasing.

Constraints

1 \leq N,A,B \leq 3\times 10^5

All input values are integers.

Input

Input is given from Standard Input in the following format:

N A B

Output

If there are no sequences that satisfy the conditions, print -1.

Otherwise, print N integers. The i-th integer should be the i-th element of the sequence that you constructed.

Sample Input 1

5 3 2

Sample Output 1

2 4 1 5 3

One longest increasing subsequence of this sequence is {2,4,5}, and one longest decreasing subsequence of it is {4,3}.

Sample Input 2

7 7 1

Sample Output 2

1 2 3 4 5 6 7

Sample Input 3

300000 300000 300000

Sample Output 3

-1

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static private IEnumerable<int> LISDL(int N, int A, int B)
        {
            if (B == 1)
            {
                if (A == N) { return Enumerable.Range(1, N); }
            }
            else
            {
                if (A >= (N + B - 1) / B)
                {
                    var ranges = new List<IEnumerable<int>>();
                    int n = N - A;
                    for (int i = 0; i < B - 1; ++i)
                    {
                        int a = n * (i + 0) / (B - 1);
                        int b = n * (i + 1) / (B - 1);
                        ranges.Add(Enumerable.Range(a + 1, b - a));
                    }
                    ranges.Add(Enumerable.Range(N - A + 1, A));
                    var list = new List<int>();
                    for (int i = ranges.Count - 1; i >= 0; --i) { list.AddRange(ranges[i]); }
                    return list;
                }
            }
            return new int[] { -1 };
        }
        static private IEnumerable<int> Solve(int N, int A, int B)
        {
            return (A > B) ? LISDL(N, A, B) : LISDL(N, B, A).Reverse();
        }
        static void Main(string[] args)
        {
            int[] values = ReadInts();
            Console.WriteLine(string.Join(" ", Solve(values[0], values[1], values[2])));
        }
    }
}