BALLS - Distributing the balls

no tags 

In this task you have compute the number of ways we can distribute A balls into B cells with with every cell having at-least one ball. 

Input

The inputs A and B are given in a single line separated by a blank,the inputs are terminated by EOF.

Output

Output the answer modulus 247383691.

 

Score

Score is the length of your code.

Example

Input:
12 4
6 3

Output:

14676024
540

Constraints
  • Every A and B can be distinguishable.
  • [math]0 \le A \le 1000000 [\math]
  • [math]0 \le B \le 100 [\math]

hide comments
Mitch Schwartz: 2015-09-12 08:12:13

My submissions 15115055 (WA) and 15115136 (AC) are identical. Maybe some rare bug in SPOJ platform?

Bhavik: 2014-06-12 21:03:07

learned quite a few things while implementation:)

Mitch Schwartz: 2013-11-09 20:10:28

@Ouditchya Sinha: \le just means less than or equal to; [math] tags aren't used on SPOJ so it's unclear why the problem setter would write it that way.

Edit: I just saw now on http://www.spoj.com/ a news entry from 2011-01-31 stating that [math] tags can be used on SPOJ for mathematical expressions. Perhaps it was a feature that was available for a time and then removed.

Last edit: 2013-11-18 15:36:27
Ouditchya Sinha: 2013-11-09 19:57:19

Can anyone please clarify the constraints, they are not appearing properly in my Browser. Thank You. :)

Decode: 2013-10-28 15:05:37

@Debanjan:
Plz say where am i wrong:10367658

(Tjandra Satria Gunawan)(曾毅昆): 2012-09-08 18:50:19

I know the formula but i'm getting wa... Is there any tricky test case?
EDIT: Finally AC, and yes there is a tricky case in the input...

Last edit: 2012-09-08 19:07:31
Aditya Pande: 2012-07-24 04:33:44

getting tle

Hallvard Norheim Bø: 2011-06-12 00:27:05

@HWK: suddenly my solution worked! It still matches yours for all the example inputs you provided.

Finally made it! The last few bytes were hard to cut.

Last edit: 2011-06-12 01:57:53
HWK: 2011-06-11 22:49:50

@.:: Debanjan ::.: Could you please say me where my solution 5231091 fails?

Edit: I found my mistake. E.g. 3 3 fails.

Last edit: 2011-06-12 09:05:55

Added by::(){ :|: & };:
Date:2011-03-28
Time limit:0.100s-3.163s
Source limit:1000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own problem