#include <bits/stdtr1c++.h>
using namespace std;

#define mp3(a,b,c) make_pair(make_pair(a,b),c)

typedef pair<int,int> pii;
typedef pair<pii,int> p3i;

const int p[10] = {6,2,5,5,4,5,6,3,7,6};

inline int P(int n) {
  if (!n)
    return 30;
  int x = 0;
  if (n < 0) {
    x++;
    n *= -1;
  }
  while (n) {
    x += p[n%10];
    n /= 10;
  }
  return 5*x;
}

unordered_map<int,int> pu;
map<p3i,int> m;

int main() {
  ios::sync_with_stdio(0);
  for (int i = -999; i < 1000; i++)
    pu[i] = P(i);
  for (int i = -999; i < 1000; i++) {
    for (int j = -999; j < 1000; j++) {
      int k;
      k = i+j;
      if (-999 <= k && k <= 999)
        m[mp3(pu[i],pu[j],pu[k])]++;
      k = i-j;
      if (-999 <= k && k <= 999)
        m[mp3(pu[i],pu[j],pu[k])]++;
      k = i*j;
      if (-999 <= k && k <= 999)
        m[mp3(pu[i],pu[j],pu[k])]++;
      if (j != 0) {
        k = i/j;
        if (-999 <= k && k <= 999)
          m[mp3(pu[i],pu[j],pu[k])]++;
      }
    }
  }
  int x, y, z;
  while (cin >> x >> y >> z && x) {
    int a = m[mp3(x,y,z)];
    cout << a << " solution";
    if (a != 1)
      cout << "s";
    cout << " for " << x << " " << y << " " << z << "\n";
  }
  return 0;
}