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


object FourRings {
 
  def fourSquare(low: Int, high: Int, unique: Boolean, print: Boolean): Unit = {
    def isValid(needle: Integer, haystack: Integer*) = !unique || !haystack.contains(needle)
 
    if (print) println("a b c d e f g")
 
    var count = 0
    for {
      a <- low to high
      b <- low to high if isValid(a, b)
      fp = a + b
      c <- low to high if isValid(c, a, b)
      d <- low to high if isValid(d, a, b, c) && fp == b + c + d
      e <- low to high if isValid(e, a, b, c, d)
      f <- low to high if isValid(f, a, b, c, d, e) && fp == d + e + f
      g <- low to high if isValid(g, a, b, c, d, e, f) && fp == f + g
    } {
      count += 1
      if (print) println(s"$a $b $c $d $e $f $g")
    }
 
    println(s"There are $count ${if(unique) "unique" else "non-unique"} solutions in [$low, $high]")
  }
 
  def main(args: Array[String]): Unit = {
    fourSquare(1, 7, unique = true, print = true)
    fourSquare(3, 9, unique = true, print = true)
    fourSquare(0, 9, unique = false, print = false)
  }
}