def safe_sum(v1, v2):
    """Sum two integers (string type) accounting for the possibility that one or both
    is missing; returns an integer."""
    if v1:
        if v2:
            return int(v1) + int(v2)
        else:
            return int(v1)
    if v2:
        return int(v2)
    return 0