Advertisement
mfgnik

Untitled

Jul 5th, 2020
1,309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. class Item:
  2.     def __init__(self, value):
  3.         self.value = value % 3
  4.  
  5.     def __add__(self, other):
  6.         return Item(self.value + other.value)
  7.  
  8.     def __radd__(self, other):
  9.         return Item(self.value + other)
  10.  
  11.     def __repr__(self):
  12.         return str(self.value)
  13.  
  14.  
  15. numbers = list(map(Item, map(int, input().split())))
  16. print(sum(numbers))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement