[Java/C++/Python] Easy and Concise
Explanation\nsa is the minimum total of array A\nsb is the minimum total of array A\n\na0 is the number of 0 in A.\nb0 is the number of 0 in B.\n\nIf sa < sb &&
# **Explanation**\n`sa` is the minimum total of array `A`\n`sb` is the minimum total of array `A`\n\n`a0` is the number of `0` in `A`.\n`b0` is the number of `0` in `B`.\n\nIf `sa < sb && a0 == 0`, return -1.\nIf `sa > sb && b0 == 0`, return -1.\n\nfinally we return `max(sa, sb)`\n<br>\n\n# **Complexity**\nTime `O(n)`\nSpace `O(1)`\n<br>\n\n**Java**\n```java\n    public long minSum(int[] A, int[] B) {\n        long sa = 0, sb = 0, a0 = 0, b0 = 0;\n        for (int a: A) {\n            a0 += a > 0 ? 0: 1;\n            sa += Math.max(a, 1);\n        }\n        for (int b: B) {\n            b0 += b > 0 ? 0: 1;\n            sb += Math.max(b, 1);\n        }\n        if (sa < sb && a0 == 0) return -1;\n        if (sa > sb && b0 == 0) return -1;\n        return Math.max(sa, sb);\n    }\n```\n\n**C++**\n```cpp\n    long long minSum(vector<int>& A, vector<int>& B) {\n        long long sa = 0, sb = 0, a0 = 0, b0 = 0;\n        for (int a: A) {\n            a0 += a == 0;\n            sa += max(a, 1);\n        }\n        for (int b: B) {\n            b0 += b == 0;\n            sb += max(b, 1);\n        }\n        if (sa < sb && a0 == 0) return -1;\n        if (sa > sb && b0 == 0) return -1;\n        return max(sa, sb);\n    }\n```\n\n**Python**\n```py\n    def minSum(self, A: List[int], B: List[int]) -> int:\n        sa = sum(max(a, 1) for a in A)\n        sb = sum(max(b, 1) for b in B)\n        if sa < sb and A.count(0) == 0: return -1\n        if sa > sb and B.count(0) == 0: return -1\n        return max(sa, sb)\n```\n
['C', 'Python', 'Java']