A tree is an undirected connected graph without cycles. The distance between two vertices is the number of edges in a simple path between them.

Limak is a little polar bear. He lives in a tree that consists of n vertices, numbered 1 through n.

Limak recently learned how to jump. He can jump from a vertex to any vertex within distance at most k.

For a pair of vertices (s, t) we define f(s, t) as the minimum number of jumps Limak needs to get from s to t. Your task is to find the sum of f(s, t) over all pairs of vertices (s, t) such that s < t.

Input

The first line of the input contains two integers n and k (2 ≤ n ≤ 200 000, 1 ≤ k ≤ 5) — the number of vertices in the tree and the maximum allowed jump distance respectively.

The next n - 1 lines describe edges in the tree. The i-th of those lines contains two integers ai and bi (1 ≤ ai, bi ≤ n) — the indices on vertices connected with i-th edge.

It's guaranteed that the given edges form a tree.

Output

Print one integer, denoting the sum of f(s, t) over all pairs of vertices (s, t) such that s < t.

Examples

Input

6 2
1 2
1 3
2 4
2 5
4 6


Output

20


Input

13 3
1 2
3 2
4 2
5 2
3 6
10 6
6 7
6 13
5 8
5 9
9 11
11 12


Output

114


Input

3 5
2 1
3 1


Output

3

Note

In the first sample, the given tree has 6 vertices and it's displayed on the drawing below. Limak can jump to any vertex within distance at most 2. For example, from the vertex 5 he can jump to any of vertices: 1, 2 and 4 (well, he can also jump to the vertex 5 itself).

<image>

There are <image> pairs of vertices (s, t) such that s < t. For 5 of those pairs Limak would need two jumps: (1, 6), (3, 4), (3, 5), (3, 6), (5, 6). For other 10 pairs one jump is enough. So, the answer is 5·2 + 10·1 = 20.

In the third sample, Limak can jump between every two vertices directly. There are 3 pairs of vertices (s < t), so the answer is 3·1 = 3.
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

public class Main {
	static PrintWriter out;
	static Reader in;
	public static void main(String[] args) throws IOException {
		input_output();
		Main solver = new Main();
		solver.solve();
		out.close();
		out.flush();
	}

	static long INF = (long)1e18;
	static int MAXN = (int)4e5 + 5;
	static int MOD = (int)1e9 + 7;
	static int q, t, n, m, k;
	static double pi = Math.PI;

	static List<Integer> adj[];
	static long[][][] dp;
	static long[][][] down;

	void solve() throws IOException {
		n = in.nextInt();
		k = in.nextInt();

		adj = new ArrayList[n + 1];
		for (int i = 1; i <= n; i++) adj[i] = new ArrayList<Integer>();

		for (int i = 0; i < n - 1; i++) {
			int u = in.nextInt(),
			    v = in.nextInt();

			adj[u].add(v);
			adj[v].add(u);
		}

		dp = new long[n + 1][k][2]; // 0 = count paths, 1 = count k-edges
		down = new long[n + 1][k][2]; // same
		dfs(1, 0);

		long ans = 0;
		for (int i = 1; i <= n; i++) {
			//out.println(i);
			//out.print(dp[i][0][0]+" "+dp[i][0][1]);
			ans += dp[i][0][1];
			for (int j = 1; j < k; j++) {
				ans += dp[i][j][1];
				ans += dp[i][j][0];
				//out.print(" : "+dp[i][j][0]+" "+(dp[i][j][1]+dp[i][j][0]));
			}
			//out.println();
		}

		out.println(ans);
	}

	static void dfs(int s, int p) {
		down[s][0][0] = 1;

		for (int e : adj[s]) {
			if (e == p) continue;
			dfs(e, s);
			merge(dp[s], down[s], down[e]);
		}
	}

	static void merge(long[][] dp, long[][] down1, long[][] down2) {
		for (int i = 0; i < k; i++) {
			for (int jj = 0; jj < k; jj++) {
				int j = jj+1;
				if (i + j >= k) {
					dp[i + j - k][1] += down1[i][1] * down2[jj][0] + down2[jj][1] * down1[i][0] + down1[i][0] * down2[jj][0];
					dp[i + j - k][0] += down1[i][0] * down2[jj][0];
				} else {
					j %= k;
					dp[i + j][1] += down1[i][1] * down2[jj][0] + down2[jj][1] * down1[i][0];
					dp[i + j][0] += down1[i][0] * down2[jj][0];
				}
			}
		}

		for (int i = 0; i < k; i++) {
			if (i + 1 == k) {
				down1[0][0] += down2[i][0];
				down1[0][1] += down2[i][1] + down2[i][0];
			} else {
				down1[i + 1][0] += down2[i][0];
				down1[i + 1][1] += down2[i][1];
			}
		}
	}

	static class Reader {
		private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public Reader() {
			this(System.in);
		}

		public Reader(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1) {
				throw new InputMismatchException();

			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}
	static void input_output() throws IOException {
		File f = new File("in.txt");
		if (f.exists() && !f.isDirectory()) {
			in = new Reader(new FileInputStream("in.txt"));
		} else in = new Reader();
		f = new File("out.txt");
		if (f.exists() && !f.isDirectory()) {
			out = new PrintWriter(new File("out.txt"));
		} else out = new PrintWriter(System.out);
	}
}