4-rings or 4-squares puzzle

You are encouraged to solve this task according to the task description, using any language you may know.
Task

Replace       a, b, c, d, e, f,   and
  g        with the decimal
digits   LOW   ───►   HIGH

such that the sum of the letters inside of each of the four large squares add up to
the same sum.

            ╔══════════════╗      ╔══════════════╗
            ║              ║      ║              ║
            ║      a       ║      ║      e       ║
            ║              ║      ║              ║
            ║          ┌───╫──────╫───┐      ┌───╫─────────┐
            ║          │   ║      ║   │      │   ║         │
            ║          │ b ║      ║ d │      │ f ║         │
            ║          │   ║      ║   │      │   ║         │
            ║          │   ║      ║   │      │   ║         │
            ╚══════════╪═══╝      ╚═══╪══════╪═══╝         │
                       │       c      │      │      g      │
                       │              │      │             │
                       │              │      │             │
                       └──────────────┘      └─────────────┘

Show all output here.



   Show all solutions for each letter being unique with
        LOW=1     HIGH=7

   Show all solutions for each letter being unique with
        LOW=3     HIGH=9

   Show only the   number   of solutions when each letter can be non-unique
        LOW=0     HIGH=9



Related task

 Solve the no connection puzzle


BEGIN
    # solve the 4 rings or 4 squares puzzle                                             #
    # we need to find solutions to the equations: a + b = b + c + d = d + e + f = f + g #
    # where a, b, c, d, e, f, g in lo : hi ( not necessarily unique )                   #
    # depending on show, the solutions will be printed or not                           #
    PROC four rings = ( INT lo, hi, BOOL unique, show )VOID:
    BEGIN
        INT  solutions := 0;
        BOOL allow duplicates = NOT unique;
        # calculate field width for printinhg solutions #
        INT  width := -1;
        INT  max := ABS IF ABS lo > ABS hi THEN lo ELSE hi FI;
        WHILE max > 0 DO
            width -:= 1;
            max OVERAB 10
        OD;
        # find solutions #
        FOR a FROM lo TO hi DO
            FOR b FROM lo TO hi DO
                IF allow duplicates OR a /= b THEN
                    INT t = a + b;
                    FOR c FROM lo TO hi DO
                        IF allow duplicates OR ( a /= c AND b /= c ) THEN
                            FOR d FROM lo TO hi DO
                                IF allow duplicates OR ( a /= d AND b /= d AND c /= d )
                                THEN
                                    IF b + c + d = t THEN
                                        FOR e FROM lo TO hi DO
                                            IF allow duplicates
                                            OR ( a /= e AND b /= e AND c /= e AND d /= e )
                                            THEN
                                                FOR f FROM lo TO hi DO
                                                    IF allow duplicates
                                                    OR ( a /= f AND b /= f AND c /= f AND d /= f AND e /= f )
                                                    THEN
                                                        IF d + e + f = t THEN
                                                            FOR g FROM lo TO hi DO
                                                                IF allow duplicates
                                                                OR ( a /= g AND b /= g AND c /= g AND d /= g AND e /= g AND f /= g )
                                                                THEN
                                                                    IF f + g = t THEN
                                                                        solutions +:= 1;
                                                                        IF show THEN
                                                                            print( ( whole( a, width ), whole( b, width )
                                                                                   , whole( c, width ), whole( d, width )
                                                                                   , whole( e, width ), whole( f, width )
                                                                                   , whole( g, width ), newline
                                                                                   )
                                                                                 )
                                                                        FI
                                                                    FI
                                                                FI
                                                            OD # g #
                                                        FI
                                                    FI
                                                OD # f #
                                            FI
                                        OD # e #
                                    FI
                                FI
                            OD # d #
                        FI
                    OD # c #
                FI
            OD # b #
        OD # a # ;
        print( ( whole( solutions, 0 )
               , IF unique THEN " unique" ELSE " non-unique" FI
               , " solutions in "
               , whole( lo, 0 )
               , " to "
               , whole( hi, 0 )
               , newline
               , newline
               )
             )
    END # four rings # ;
 
    # find the solutions as required for the task #
    four rings( 1, 7, TRUE,  TRUE  );
    four rings( 3, 9, TRUE,  TRUE  );
    four rings( 0, 9, FALSE, FALSE )
END