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.util.*;
import java.io.*;
import java.math.*;
public class Solution{
    
    static class Reader 
    { 
        final private int BUFFER_SIZE = 1 << 16; 
        private DataInputStream din; 
        private byte[] buffer; 
        private int bufferPointer, bytesRead; 
  
        public Reader() 
        { 
            din = new DataInputStream(System.in); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public Reader(String file_name) throws IOException 
        { 
            din = new DataInputStream(new FileInputStream(file_name)); 
            buffer = new byte[BUFFER_SIZE]; 
            bufferPointer = bytesRead = 0; 
        } 
  
        public String readLine() throws IOException 
        { 
            byte[] buf = new byte[64]; // line length 
            int cnt = 0, c; 
            while ((c = read()) != -1) 
            { 
                if (c == '\n') 
                    break; 
                buf[cnt++] = (byte) c; 
            } 
            return new String(buf, 0, cnt); 
        } 
  
        public int nextInt() throws IOException 
        { 
            int ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do
            { 
                ret = ret * 10 + c - '0'; 
            }  while ((c = read()) >= '0' && c <= '9'); 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public long nextLong() throws IOException 
        { 
            long ret = 0; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        public double nextDouble() throws IOException 
        { 
            double ret = 0, div = 1; 
            byte c = read(); 
            while (c <= ' ') 
                c = read(); 
            boolean neg = (c == '-'); 
            if (neg) 
                c = read(); 
  
            do { 
                ret = ret * 10 + c - '0'; 
            } 
            while ((c = read()) >= '0' && c <= '9'); 
  
            if (c == '.') 
            { 
                while ((c = read()) >= '0' && c <= '9') 
                { 
                    ret += (c - '0') / (div *= 10); 
                } 
            } 
  
            if (neg) 
                return -ret; 
            return ret; 
        } 
  
        private void fillBuffer() throws IOException 
        { 
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
            if (bytesRead == -1) 
                buffer[0] = -1; 
        } 
  
        private byte read() throws IOException 
        { 
            if (bufferPointer == bytesRead) 
                fillBuffer(); 
            return buffer[bufferPointer++]; 
        } 
  
        public void close() throws IOException 
        { 
            if (din == null) 
                return; 
            din.close(); 
        } 
    } 
    
    static Node[] node;
    static long answer;
    static int n;
    static int k;
    
    static class Node{
        int id;
        int father;
        int finiched;
        LinkedList<Integer> neighbers = new LinkedList<Integer>();
        long[] nb;
        long[] cost;
        public Node(int id){
            this.id = id;
            father = 0;
            nb = new long[k+1];
            cost = new long[k+1];
            finiched = 0;
        }
        
    }
    
    static void racine(){
        
        LinkedList<Integer> nextToVisit = new LinkedList<Integer>();
        nextToVisit.add(1);
        while(!nextToVisit.isEmpty()){
            int id = nextToVisit.poll();
            for(int i:node[id].neighbers){
                if(node[id].father==i) continue;
                node[i].father = id;
                nextToVisit.add(i);
            }
        }
        
    }
    
    static void bfs(){
        
        LinkedList<Integer> next = new LinkedList<Integer>();
        for(int i=2;i<=n;i++){
            if(node[i].neighbers.size()==1) next.add(i);
        }
        
        while(!next.isEmpty()){
            
            
            
            int id = next.poll();
            
            //System.out.println(id);
            
            for(int i=1;i<=k;i++) {
                answer += node[id].cost[i];
            }
            
            if(id==1) break;
            int father = node[id].father;
            
            long[] nb = new long[k+1];
            long[] cost = new long[k+1];
            
            betweenfather_sun(nb,cost,node[id].nb,node[id].cost);
            
            betweensuns(node[father].nb,node[father].cost,nb,cost);
            
            betweenfather_sun(node[father].nb,node[father].cost,node[id].nb,node[id].cost);
            
            
            node[father].finiched++;
            if(father==1){
                if(node[father].finiched==node[father].neighbers.size()) next.add(father);
            }  
            else if(node[father].finiched==node[father].neighbers.size()-1) next.add(father);
            
        }
        
        
        
    }
    
    static void betweenfather_sun(long[] nb,long[] cost,long[] nbp,long[] costp){
        
        nb[1]++;
        cost[1]++;
        cost[1] += nbp[k];
        nb[1] += nbp[k];
        cost[1] += costp[k];
        for(int i=2;i<=k;i++){
            nb[i] += nbp[i-1];
            cost[i] += costp[i-1];
        }
        
        
    }
    
    static void betweensuns(long[] nb,long[] cost,long[] nbp,long[] costp){
        
        long val1,val2;
        for(int i=1;i<=k;i++){
            for(int j=1;j<=k;j++){
                val1 = cost[i] - nb[i];
                val2 = costp[j] - nbp[j];
                answer += cost[i] * nbp[j];
                answer += costp[j] * nb[i];
                if(i+j<=k){
                    answer -= nb[i]*nbp[j];
                }
            }
        }
        
    }
    
    
    

    public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //StringTokenizer st = new StringTokenizer(br.readLine());
        Reader sc = new Reader();
        
        PrintWriter out = new PrintWriter(System.out);
        
        n = sc.nextInt();
        k = sc.nextInt();
        
        answer = 0;
        
        node = new Node[n+1];
        for(int i=1;i<=n;i++) node[i] = new Node(i);
        
        for(int i=0;i<n-1;i++) {
            int u = sc.nextInt();
            int v = sc.nextInt();
            node[u].neighbers.add(v);
            node[v].neighbers.add(u);
        }
        
        racine();
        
        bfs();
        
        //for(int i=1;i<=n;i++){
        //    System.out.println(i+" "+node[i].father);
        //}
        
        /*
        for(int i=1;i<=n;i++){
            System.out.println(i+"     :");
            for(int j=1;j<=k;j++){
                System.out.print(node[i].nb[j]+" ");
            }
            System.out.println("");
            for(int j=1;j<=k;j++){
                System.out.print(node[i].cost[j]+" ");
            }
            System.out.println("");
        }
        */
        
        
        
        out.println(answer);
        
        out.flush();
    }
    
}