#include <iostream> #include <cstdio> using namespace std; int main() { int n, x, y, z; int price; while(cin>>n>>x>>y>>z){ bool stop = false; for(int i=9;i>0;i--){ for(int j=9;j>=0;j--){ if((i*10000+x*1000+y*100+z*10+j)%n==0){ price=(i*10000+x*1000+y*100+z*1...