f | import sys | f | import sys |
| | | |
| | | |
| def ADD(f, g): | | def ADD(f, g): |
| if callable(f) and callable(g): | | if callable(f) and callable(g): |
n | def res(x): | n | def h(x): |
| return f(x) + g(x) | | return f(x) + g(x) |
| elif callable(f): | | elif callable(f): |
n | def res(x): | n | def h(x): |
| return f(x) + g | | return f(x) + g |
| elif callable(g): | | elif callable(g): |
n | def res(x): | n | def h(x): |
| return f + g(x) | | return f + g(x) |
| else: | | else: |
n | def res(x): | n | def h(x): |
| return f + g | | return f + g |
n | return res | n | return h |
| | | |
| | | |
| def SUB(f, g): | | def SUB(f, g): |
| if callable(f) and callable(g): | | if callable(f) and callable(g): |
n | def res(x): | n | def h(x): |
| return f(x) - g(x) | | return f(x) - g(x) |
| elif callable(f): | | elif callable(f): |
n | def res(x): | n | def h(x): |
| return f(x) - g | | return f(x) - g |
| elif callable(g): | | elif callable(g): |
n | def res(x): | n | def h(x): |
| return f - g(x) | | return f - g(x) |
| else: | | else: |
n | def res(x): | n | def h(x): |
| return f - g | | return f - g |
n | return res | n | return h |
| | | |
| | | |
| def MUL(f, g): | | def MUL(f, g): |
| if callable(f) and callable(g): | | if callable(f) and callable(g): |
n | def res(x): | n | def h(x): |
| return f(x) * g(x) | | return f(x) * g(x) |
| elif callable(f): | | elif callable(f): |
n | def res(x): | n | def h(x): |
| return f(x) * g | | return f(x) * g |
| elif callable(g): | | elif callable(g): |
n | def res(x): | n | def h(x): |
| return f * g(x) | | return f * g(x) |
| else: | | else: |
n | def res(x): | n | def h(x): |
| return f * g | | return f * g |
n | return res | n | return h |
| | | |
| | | |
| def DIV(f, g): | | def DIV(f, g): |
| if callable(f) and callable(g): | | if callable(f) and callable(g): |
n | def res(x): | n | def h(x): |
| return f(x) / g(x) | | return f(x) / g(x) |
| elif callable(f): | | elif callable(f): |
n | def res(x): | n | def h(x): |
| return f(x) / g | | return f(x) / g |
| elif callable(g): | | elif callable(g): |
n | def res(x): | n | def h(x): |
| return f / g(x) | | return f / g(x) |
| else: | | else: |
n | def res(x): | n | def h(x): |
| return f / g | | return f / g |
t | return res | t | return h |
| | | |
| | | |
| exec(sys.stdin.read(), globals()) | | exec(sys.stdin.read(), globals()) |
| | | |