diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -64,7 +64,7 @@
         dp = [(x + y) % P for x, y in zip(dp, psum)]
         # print(addon, dp)
 
-    print(dp[-1] - dp[-2])
+    print((dp[-1] - dp[-2]) % P)
 
 
 if __name__ == "__main__":
