#import <Foundation/Foundation.h>
#import <stdlib.h>
#import <stdarg.h>
typedef NSInteger Int;
#ifndef _OS_OSTYPES_H
typedef NSUInteger UInt;
#endif
/// NSSet literal
#if !defined($)
#define $(...)  ([NSSet setWithArray: @[__VA_ARGS__]])
#endif
@interface StdIO : NSObject
+(NSMutableString*)stringFromStdIn;
+(NSMutableArray*)stringsFromStdInSeparatedByString:(NSString*)separator;
+(NSMutableArray*)stringsFromStdInSeparatedByCharacter:(unichar)separator;
+(NSMutableArray*)numbersFromStdInSeparatedByString:(NSString*)separator;
+(NSMutableArray*)numbersFromStdInSeparatedByCharacter:(unichar)separator;
+(void)put:(char*)format, ...;
+(void)puts:(NSString*)format, ...;
@end
@interface NSString (Extension)
-(NSMutableArray*)componentsSeparatedByCharacter:(unichar)separator;
-(NSMutableArray*)numbersSeparatedByString:(NSString*)separator;
-(NSMutableArray*)numbersSeparatedByCharacter:(unichar)separator;
-(NSMutableArray*)splitCharacterEvery:(UInt)number;
-(NSMutableArray*)characterStrings; // 1文字ずつの NSString* の配列を返す
-(NSMutableArray*)characters; // 1文字ずつの unichar をラップした NSNumber の配列を返す
-(unichar)firstCharacter;
-(unichar)lastCharacter;
-(NSString*)leadingSubstringWithLength:(UInt)length;
-(NSString*)trailingSubstringWithLength:(UInt)length;
@end
@interface NSMutableString (Extension)
-(NSMutableString*)unshift:(NSString*)string;
-(NSString*)shiftWithLength:(UInt)length;
-(NSMutableString*)push:(NSString*)string;
-(NSString*)popWithLength:(UInt)length;
@end
@implementation NSString (Extension)
-(NSMutableArray*)componentsSeparatedByCharacter:(unichar)separator
{
    return [NSMutableArray arrayWithArray: [self componentsSeparatedByString:[NSString stringWithFormat:@"%c", separator]]];
}
-(NSMutableArray*)numbersSeparatedByString:(NSString*)separator
{
    NSArray *strings = [self componentsSeparatedByString: separator];
    NSMutableArray *numbers = [NSMutableArray array];
    for (NSString *string in strings) {
        if (![string isEqualToString:@""]) {
            [numbers addObject: [NSNumber numberWithInteger: [string integerValue]]];
        }
    }
    return numbers;
}
-(NSMutableArray*)numbersSeparatedByCharacter:(unichar)separator
{
    return [self numbersSeparatedByString:[NSString stringWithFormat:@"%c", separator]];
}
-(NSMutableArray*)splitCharacterEvery:(UInt)number
{
    if ([self length] <= number) {
        return [NSMutableArray arrayWithObject: self];
    }
    NSMutableArray  *mArray = [NSMutableArray array];
    NSMutableString *mStr   = [NSMutableString stringWithString: self];
    NSRange range = NSMakeRange(0, number);
    while ([mStr length] > 0) {
        if ([mStr length] < number) {
            [mArray addObject: [NSString stringWithString: mStr]];
            [mStr deleteCharactersInRange:NSMakeRange(0, [mStr length])];
        } else {
            [mArray addObject: [mStr substringWithRange: range]];
            [mStr deleteCharactersInRange: range];
        }
    }
    return mArray;
}
-(NSMutableArray*)characterStrings {
    return [self splitCharacterEvery: 1];
}
-(NSMutableArray*)characters {
    NSMutableArray *result = [NSMutableArray array];
    for (UInt i=0; i<[self length]; i++) {
        [result addObject: @([self characterAtIndex: i])];
    }
    return result;
}
-(unichar)firstCharacter
{
    return [self characterAtIndex: 0];
}
-(unichar)lastCharacter
{
    return [self characterAtIndex: [self length] - 1];
}
-(NSString*)leadingSubstringWithLength:(UInt)length
{
    if (length <= [self length]) {
        return [self substringWithRange: NSMakeRange(0, length)];
    } else {
        return nil;
    }
}
-(NSString*)trailingSubstringWithLength:(UInt)length
{
    UInt mylength = [self length];
    if (length <= mylength) {
        return [self substringWithRange: NSMakeRange(mylength - length, length)];
    } else {
        return nil;
    }
}
@end
@implementation NSMutableString (Extension)
-(NSMutableString*)unshift:(NSString*)string
{
    [self insertString: string atIndex: 0];
    return self;
}
-(NSString*)shiftWithLength:(UInt)length
{
    if ([self length] >= length) {
        NSRange range = NSMakeRange(0, length);
        NSString *first = [self substringWithRange: range];
        [self deleteCharactersInRange: range];
        return first;
    } else {
        return nil;
    }
}
-(NSString*)push:(NSString*)string
{
    [self appendString: string];
    return self;
}
-(NSString*)popWithLength:(UInt)length
{
    UInt mylength = [self length];
    if (length <= mylength) {
        NSRange range = NSMakeRange(mylength - length, length);
        NSString *last = [self substringWithRange: range];
        [self deleteCharactersInRange: range];
        return last;
    } else {
        return nil;
    }
}
@end
@implementation StdIO
+(NSMutableString*)stringFromStdIn
{
    NSFileHandle *handle = [NSFileHandle fileHandleWithStandardInput];
    NSMutableString *result = [NSMutableString string];
    NSData *data = [handle availableData];
    while ([data length] > 0) {
        [result appendString:[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]];
        data = [handle availableData];
    }
    if ([result lastCharacter] == '\n') {
        [result popWithLength: 1];
    }
    return result;
}
+(NSMutableArray*)stringsFromStdInSeparatedByString:(NSString*)separator
{
    return [NSMutableArray arrayWithArray: [[StdIO stringFromStdIn] componentsSeparatedByString: separator]];
}
+(NSMutableArray*)stringsFromStdInSeparatedByCharacter:(unichar)separator
{
    return [NSMutableArray arrayWithArray: [[StdIO stringFromStdIn] componentsSeparatedByCharacter: separator]];
}
+(NSMutableArray*)numbersFromStdInSeparatedByString:(NSString*)separator
{
    return [[StdIO stringFromStdIn] numbersSeparatedByString: separator];
}
+(NSMutableArray*)numbersFromStdInSeparatedByCharacter:(unichar)separator
{
    return [[StdIO stringFromStdIn] numbersSeparatedByCharacter: separator];
}
+(void)putsToStdOut:(NSString*)string
{
    NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
    [fileHandle writeData:[string dataUsingEncoding: NSUTF8StringEncoding]];
    [fileHandle writeData:[@"\n" dataUsingEncoding: NSUTF8StringEncoding]];
}
+(void)put:(char*)format, ...
{
    va_list arguments;
    va_start(arguments, format);
    NSString *string = [[NSString alloc] initWithFormat: [NSString stringWithUTF8String: format] arguments: arguments];
    [StdIO putsToStdOut: string];
    va_end(arguments);
}
+(void)puts:(NSString*)format, ...
{
    va_list arguments;
    va_start(arguments, format);
    NSString *string = [[NSString alloc] initWithFormat: format arguments: arguments];
    [StdIO putsToStdOut: string];
    va_end(arguments);
}
@end
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSString *s = [StdIO stringFromStdIn];
        Int n = [s integerValue];
        Int sum = 0;
        for (NSNumber *i in [s characters]) {
            sum += [[NSString stringWithFormat:@"%c", [i unsignedIntegerValue]] integerValue];
        }
        [StdIO put:n%sum==0?"Yes":"No"];
 }
    return 0;
}


Measured memory_bytes: 2404