F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Round Table Banquet

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 178    Accepted Submission(s): 8


Problem Description
A long time ago, a king held a banquet to celebrate his birthday, and he invited lots of guests sitting in a large round table. The king prepared several kinds of food, and he wants any two guests sit at a distance of three enjoys different kind of food.
But how many plans can be there? Because the number can be huge, output the its last four digits will be fine.
 

Input
There are multiple test cases, each test case contains two positive numbers n (4<=n<=10000000000) and m (2<=m<=100), indicates the number of guests and the kinds of food.
The input is terminated when n=m=0.
 

Output
For each test case, output four digits, indicates the last four digits of the number of plans.
 

Sample Input
5 2 5 3 0 0
 

Sample Output
0000 0030
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-26 19:35:11, Gzip enabled