summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/modular_arithmetic.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/modular_arithmetic.py b/lib/modular_arithmetic.py
index 03cb7f8..baf979a 100644
--- a/lib/modular_arithmetic.py
+++ b/lib/modular_arithmetic.py
@@ -8,6 +8,8 @@ class Mod:
__slots__ = ['val','mod']
def __init__(self, val, mod):
+ if isinstance(val, Mod):
+ val = val.val
if not isinstance(val, int):
raise ValueError('Value must be integer')
if not isinstance(mod, int) or mod<=0: